how to assign a range of pixel for pixel intensity

4 views (last 30 days)
I have a 578x50 image. I want to process a range of pixel intensities let say pixel 386 until 409 for column and pixel 2 until 49 for row. When I assign that range of pixels like this:
for c = 386:409
for r = 2:49
central_pixel(r,c) = I(r,c);
centralPixel = double(central_pixel);
if centralPixel(r,c) >= 0
central_pixel(r,c) = I(r,c);
centralPixel = double(centralPixel);
else
centralPixel = NaN;
end
end
end
the output of c = 409 and r = 49 in workspace. While the output of centralPixel display pixel intensity for 386th until 409th pixel while 0 for 1st until 385th pixel. How can I fix this? I just want to display only pixel intensity of 386th until 409th pixel for column and 2nd until 49th pixel for row. Please help. Thanks in advance

Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!