Improfile difficulties relating to a previous question

2 visualizzazioni (ultimi 30 giorni)
Thanks for the previous help in the following area of intensity obtaining along a line. I am not sure if i have to start a new question once i accept an answer but i am still having trouble, only now using improfile.
The previous question was at this location:
I have looked at some previous questions but am still having some trouble. I have now got the values of the circle and now have them in two matrices. One matrix for the x values and one for the y values. I also have the center point seen in the code as Cen x and Cen y. I have then created a loop to draw lines from the center to each of the outer points of the circle, but now i am trying to get the improfile of these and am having trouble. I am getting the following errors:
Error using interp2/makegriddedinterp (line 224) Interpolation requires at least two sample points in each dimension. Consider using INTERP1 if X or Y have constant coordinates that can be eliminated to reduce the dimension.
Error in interp2 (line 125) F = makegriddedinterp({X, Y}, V, method);
Error in improfile (line 213) zr = interp2(xGridPoints,yGridPoints,img(:,:,1),xg,yg,method);
Error in ThomasG3 (line 63) zr = improfile(CenY,CenX,line,ValuesFinal1(n,1),ValuesFinal2(n,1));
the code that i am using for this section is as follows:
%Plot the intensities
for n=1:360
ValuesFinal1(n,1)= values1(n,1)+(CenY);
ValuesFinal2(n,1)= values2(n,1)+(CenX);
[line]=vsg('DrawLine',I,[CenY,CenX],[ValuesFinal1(n,1),ValuesFinal2(n,1)],[255,255,0],1);
figure, image(uint8(line));
% CenY is the value 211, and CenX is the value 145, these are the centre points of my circle
% VaulesFinal1 and ValuesFinal2 are a list of values for the points on the
% outer radius of the circle.
zr = improfile(CenY,CenX,line,ValuesFinal1(n,1),ValuesFinal2(n,1));
%Also tried to use the following with no success.
zr = interp2(CenY,CenX,I,ValuesFinal1(n,1),ValuesFinal2(n,1));
end
I would appreciate your help again, Thanks Tom

Risposte (1)

Image Analyst
Image Analyst il 11 Lug 2013
I don't know what line is but don't use that name for a variable - it's a built-in function name. Secondly, CenY and CenX should each be a by 2 array since the are supposed to have both endpoints of the line. And I don't see where you're passing the image (with the poorly chosen name I) into improfile.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by