![]() ![]() The result is an image that looks cleaner, with less noise or grain, and typically shows a finer distinction between highlights and shadows. The larger the sensor, the larger the pixels can be, and the more photons each pixel can hold. Offsets = 0.Image sensors come in different sizes. function V = pixelHull(P,type)Įlse % type is number of angles for sampling a circle of diameter 1. ![]() The rest of the post contains functions used by the code above. (Note: A comment that says, "Steve, you're totally overthinking this" would be totally legit.) If you have an opinion, please share it in the comments. The degeneracies associated with point pixels are just too troublesome. ![]() My only firm conclusion is that the point approximation is the worst choice. imshow(bw)Īfter all this, I'm still not completely certain which shape assumption will generally work best. You have to use square pixels to get corner-to-corner. I think many people might expect the maximum Feret diameter to go corner-to-corner in this case, but it doesn't exactly do that. = maxFeretDiameter(V,antipodalPairs(V)) Here's the maximum Feret diameter using that approximation. The call pixelHull(bw,24) computes the pixel hull using a 24-point circle approximation. I wrote a function called pixelHull that can compute the convex hull of binary image pixels in a variety of different ways. Let's go back to the Martha's Vinyard blob that I started with. Still, a circular approximation might not always give exactly what a user might expect. The orientation would also be as expected for a horizontal or vertical segment of pixels. The maximum Feret distance of this horizontal segment of is 6.0828 ($\sqrt$. Title( 'The maximum Feret diameter is not horizontal') = maxFeretDiameter(points,antipodalPairs(points)) However, it loses some of its appeal when you consider the implications for computing the maximum Feret diameter. Here's one way to perform that computation. We can, instead, treat each pixel as a square by computing the convex hull of all the corners of every pixel. In the computation of the convex hull above, we treated each pixel as a point. We can solve this degeneracy problem by using square pixels. The points may be collinear."īut even if it did return an answer, the answer would be a degenerate polygon with length 5 (even though the number of foreground pixels is 6) and zero area. tryįprintf( 'Error message from convhull: "%s"\n', e.message) Įnd Error message from convhull: "Error computing the convex hull. The function convhull doesn't even work on colinear points. Weaknesses of Using the Pixel CentersĬonsider a simpler binary object, one that has only one row. That's because we are only using the pixel centers. Notice, though, that there are white bits showing outside the red convex hull polygon. Title( 'A Blob''s Convex Hull and Its Vertices') We can eliminate these vertices directly in the call to convhull using the 'Simplify' parameter. In some of the other processing steps related to Feret diameter measurements, colinear convex hull vertices can cause problems. Notice that there are some chains of three or more colinear convex hull vertices. Title( 'Pixel centers and convex hull vertices') Hull_line = plot(x_hull,y_hull, 'r*', 'MarkerSize',12) I'm not going to show that step everywhere in this example, though. As an optimization that I think will often reduce execution time and memory, I'm going to preprocess the input binary image here by calling bwperim. We can use find to get the $x$- and $y$-coordinates of the pixel centers, and then we can use convhull to find their convex hull. Most of the time, we think of image pixels as being squares with unit area. Here's a binary image with a single foreground blob (or "object," or "connected component.") bw = imread( 'Martha''s Vineyard (30x20).png') (See 2, 2, and 2.) Let me try to explain why. I recall back in grad school doing some homework where we were treating pixels as hexagons.Īs I haved worked through the last few posts on computing Feret diameters, though, I have started to entertain the possible usefulness of considering pixels to be circles. What is the shape of a pixel? At various times, I have a pixel as a square (often), a point (sometimes), or a rectangle (occasionally). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |