How to select framework of an image?
5 次查看(过去 30 天)
显示 更早的评论
I am working on a programm to analyze over a Million pictures for my Bachelor's thesis and I'm quite stuck on this matter here:
The pictures/images have a size of 1024x1024 pixels. Now I need to (as quickly as possible) control the outer framework of each image. Anybody know how to help me with that? I'm posting what I've already made by selecting an 800x800 pixel area of each image in hopes to modify it into selecting onl the outer frame - to no avail.
Also the pictures are binarized, in case it might matter.
frame = BW2([1 1024 2:1023], [1:1024 1 1024]);
Please tell me if you need more info.
EDIT: I meant "as quickly as possible" in terms of not taking up too much time while running. This program should be able to analyze many images as quickly as possible so it won't have to run that long.
0 个评论
回答(2 个)
KALYAN ACHARJYA
2022-1-27
You can consider a frame of selection, force remaining pixels to black(0) or white(255), let's suppose data is a gray image-
data([1:50,50+end],:)=0;
%.......^ change accordingly
data(:,[1:50,50+end])=0;
figure, imshow(data);
Image Analyst
2022-3-3
I'm not sure what you mean exactly by "control".
This syntax is not really right for a 2-D binary image
frame = BW2([1 1024 2:1023], [1:1024 1 1024]);
I think you would get the whole image again. If you want to crop out an 800 by 800 subimage at 112, 112, do this
topRow = 112;
leftColumn = 112;
frame = BW2(topRow : topRow + 799, leftColumn : leftColumn + 799);
If you want to get the outer edges individually you can get them like this:
topRow = BW2(1, :);
bottomRow = BW2(end, :);
leftColumn = BW2(:, 1);
rightColumn = BW2(:, end);
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!