Binarization to Crop Image
显示 更早的评论
In my code I use binarization to crop my region of interest from a photograph to observe lightness values as shown bellow:

This is my code:
I0 = imread(f{3}); %f{3} is some random photo in this case
I1 = I0(:,:,3); % select 3d channel
I2 = im2bw(I1,graythresh(I1)-0.1); % binarization
figure(n);
imshow(I2)
h = msgbox('select region of interest');
uiwait(h)
p = ginput(1); % pick point
I3 = bwselect(~I2,p(1),p(2)); % select region of interest
I4 = cat(3,I3,I3,I3);
I5 = uint8(I4).*I0; % crop rgb image
imshow(I5);
My question is as follows:
I made some modifications to my image and now it is:

My current code (even when I try and tweak the threshold) won't strictly pick up the piece of hair! I really ned help just getting the hair to pick up in the crop!
采纳的回答
更多回答(1 个)
Brian Peoples
2020-7-7
0 个投票
3 个评论
Image Analyst
2020-7-7
A little time in optimizing and standardizing your image capture conditions will make the image analysis algorithm tremendously easier. For example there are lots of cheap light boxes on Amazon.com for image capture, like the
They range from $40 to a few hundred dollars. They are for the casual, non-scientific, non-professional user, despite what they say. And as a professional, I ought to know. I call these "Ebay quality" or "Etsy quality" since that is really the market they sell to - the casual user who likes to take pictures of things to sell them online.
Of course you can get much better if you want to have your machine shop build something for you from aluminum rails, high quality camera mounts such as these RAM Mounts, lamps from AdvancedIllumination or SmartVisionLights, professional machine vision industrial or scientific cameras, and other professional components.
Good luck.
Brian Peoples
2020-7-8
Image Analyst
2020-7-8
I'd just wrap a piece of paper with text on it over the barrel and see what rows and columns the image gets too blurry for you. Then just analyze the image, or crop it, within those boundaries.
类别
在 帮助中心 和 File Exchange 中查找有关 Image Segmentation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


