See my code:
ref = Rasterize[Graphics3D[Sphere[]], ImageResolution -> 16,
Background -> LightYellow]
Model[{x_, y_}] :=
Rasterize[Graphics3D[Sphere[], ViewPoint -> {x, y, 1}],
ImageResolution -> 16, Background -> LightYellow]
CostFunction[{x_, y_}] :=
Total[Flatten[ImageData[ImageSubtract[ref, Model[{x, y}]]]]]
Plot3D[CostFunction[{x, y}], {x, -1, 3}, {y, -1, 3}].// My problem is here?????
But When I use
list = ParallelTable[{x, y, CostFunction[{x, y}]}, {x, -10,
10}, {y, -10, 10}];
list = ParallelTable[{x, y, CostFunction[{x, y}]}, {x, -10,
10}, {y, -10, 10}];
I get the function graphics! What is the problem?
In the other hand:
I want to minimize the cost function using NMinimize[]
NMinimize[CostFunction[{x, y}], {x, y}]
{22083.2,{x->0,y->0}}
But When I calculate
CostFunction[{0,0}]
I obtain 8758.65? What is the issue please?