How to generate surface of fixed width from know coordintes of curve and add pixel covered by the surface

1 view (last 30 days)
I have a set of points that describe a curve but i need to take a surface of fixed width above or below the curve and add all the pixel value covered by the surface.Any help will be appreciated.The question is made clear in the figure attached.

Answers (2)

Ben11 on 10 Apr 2015
This should do it:
close all
%// Define x and y to plot curve
%// Build 2 other arrays for y values of shaded region
y1 = y-4;
y2 = y+4;
%// Set up x and y values to fill the region
%// Fill area
hFill = fill(X,Y,[.5 0 1]);
hold on
I'll let you discover how to remove borders of the shaded region
  1 Comment
Prabin on 10 Apr 2015
Thank you for your answer. but the main problem is finding the pixel value of the surface.i can find the pixel value of the known coordinates by using impixel but any idea how can i do that for whole shaded region too

Sign in to comment.

Image Analyst
Image Analyst on 10 Apr 2015
How about just adding and subtracting something?
yTop = y + someAmount;
yBottom = y - someAmount;
Image Analyst
Image Analyst on 12 Apr 2015
Sorry, I guess I can't because I don't see how adding and subtracting some amount from the centerline won't give you the coordinates of the upper and lower envelopes.
And it looks like a 1-dimensional problem so I'm not exactly sure why you're referring to a "surface" which I usually think of as a 2 or 3 D concept.

Sign in to comment.



Community Treasure Hunt

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

Start Hunting!

Translated by