Hi,
I'll preface this by saying that I'm very new to MATLAB, so I apologize if I sound a bit incoherent.
I'm trying to figure out what the width of the border of an image would be. I have used imread to do so, and I did this for several different images, creating a figure like so (in the actual code there are more than two lines, but I only used two here for simplicity's sake):
function compare_image_profileI(:,:,1) = imread('filename_1');I(:,:,2) = imread('filename_2');trace_color(1,1) = 'b';trace_color(2,1) = 'g';figurehold onfor k = 1:2 plot(I(700,:,k), trace_color(k,1));end
Doing this allows me to create the figure that I attached (I zoomed into the area that I want to focus on).
Essentially, I want to be able to find the distance between the two points on the x-axis with a fixed y value (for example, 6000) for both of these lines respectively–basically finding the x for a given y when the line dips, and again for when it increases.
I have tried to use the interp1 function, but I can't seem to figure out how to do so with my imread-created figure. Whenever I try doing something like interp1(y,x,6000) for example I get an error saying that the function or variables are undefined. I'm not sure how I can refer to the x or y axes in this case.
Sorry for the long-winded question, and hope it made sense! Thank you so much for the help and have a lovely day 🙂
Edit: Just wanted to include that I'm fine with using something other than (or in addition to) interp1, that was just the only thing I could think of using at the moment.
Best Answer