find and plot in a x-y graph the pixels allong the red line

hello everyone does anyone know how can i find and plot in a x-y graph the pixel values along the red line in the next pic?

 Accepted Answer

3 Comments

i tried this
clc;
clear all;
img = imread('1.jpg');
img=imcrop(img)
sz = size(img);
endx = min(sz(1), sz(2));
h(1) = image(img);
hold on
h(2) = plot([1 endx], [1 endx], 'r');
hold off
h(2) = improfile
and i selected the red line but i got this error (h(2) = plot([1 endx], [1 endx], 'r'); gives me the red line like in the pic i postsed)
Cannot convert double value 109 to a handle
Error in addlinesimple (line 11)
h(2) = improfile
Why do you want to store the output of improfile in the the same array as the handles of the image and the line produced by plot? Their outputs are graphic handles, the output of improfile is numerical. Use this insteead:
result = improfile

Sign in to comment.

More Answers (0)

Categories

Tags

Asked:

on 29 Mar 2021

Commented:

on 31 Mar 2021

Community Treasure Hunt

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

Start Hunting!