How to select framework of an image?

조회 수: 1 (최근 30일)
Sokratis Panagiotidis
Sokratis Panagiotidis 2022년 1월 27일
답변: Image Analyst 2022년 3월 3일
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.

답변 (2개)

KALYAN ACHARJYA
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);
  댓글 수: 1
Sokratis Panagiotidis
Sokratis Panagiotidis 2022년 1월 28일
Hi it didn't work out as my program crashes while using it.
But I ain't sure this is what I was looking for. It seems like it sets the value of the selected area to a 0 (talking about binary image here).
Maybe I should explain better what I'm exactly looking for:
I need to look at the outer frame of a 1024x1024 image (meaning everyting that's not inside [2:1023] in both axes) and see if it has the value 0.
Do you know how I should proceed?

댓글을 달려면 로그인하십시오.


Image Analyst
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);

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by