Scan the image until the first and last points I set

4 ビュー (過去 30 日間)
Stelios Fanourakis
Stelios Fanourakis 2019 年 1 月 24 日
コメント済み: Guillaume 2019 年 1 月 28 日
Hi Matlab community.
I need your valuable help on this.
Please see attached image. I annotate the starting and end point of scanning. What I want is to scan the image starting from top (where the first black pixel begins) and stop where the first gray-white pixel of the ruler of the image that lies vertically at the right edge of the image.
The same process will be repeated from the bottom of the image scanning until the first gray-white pixel of the vertical ruler that lies at the right end side of the image. The inbetween part where the imaging window lies, will be segmented, defined somehow or separated by the rest of the image, means that anything else shall be masked.
Continuing scanning from right to left after imaging window finishes, black pixels again start, so the segmentation, differentiation shall be stopped and all other details like letters, colorbars, logos, whatever shall be masked.
The only visible part of the image should be the rectangular gray imaging window. But not at the size as you see it since the actual size of the imaging window is bigger. It starts from the first gray dash of the ruler until the last gray dash close to the bottom, even if at this place the imaging window is pure black.
Am I understood? Please, ask, whatever you don't understand.
Hope to have a and solving solution, soon enough.
Thanks for everything and also the time you spent to read this.
  21 件のコメント
Jan
Jan 2019 年 1 月 28 日
編集済み: Jan 2019 年 1 月 28 日
@Stelios: But due to the choice of a lossy and low quality JPEG compression and due to downsampling/re-scaling, there is no way to recognize pixels in the vertical ruler exactly and uniquely. I've collected the images you have posted yet and it is obvious, that each one would need another method to identify a certain pixel - if this is not made impossible by the bad choice of the image compression, rescaling, downsampling and adding of the border.
"Only to define the first and last points of the vertical ruler" - exactly this was made extremely hard, because you've posted very different inputs and the blurred contents does not allow to identify specific points. See this zoomed area of the right bottom ruler mark with increased contrast:
ruler.png
So which one is the wanted pixel?
Of course you can set some thresholds based on some expert knowledge and use AI to remove the JPEG artifacts. But it would be trivial, if you just use inputs without a lossy compression. Do you have any good reason to work with very noisy inputs? I'm convinced you have caused this noise by a repeated resampling and JPEG compression. Now the input images are trashy.
Guillaume
Guillaume 2019 年 1 月 28 日
I just need Matlab to identify those two points. First and last dash of the vertical ruler. That's all!
This needs to be automated.
Yes, we understood that. But if you want something reliable we need to know exactly what we're working with. Because the solution and its complexity is going to depend on (amongst other things):
  • Are these marks always in the same location in reference to the edges of the image. You've posted all sort of images where there is sometimes a white border, sometimes not. So, do we first have to identify that white border or not?
  • Are these marks clearly defined or plagued by jpeg compression artifacts and sometimes downsampling (despite your protests you've shown us downsampled images, see Jan's answer)

サインインしてコメントする。

採用された回答

Jan
Jan 2019 年 1 月 28 日
This does not solve the question, but is a collection of images you have posted yet:
  1. A cropped output (logo only partially visible at the top), some downsampling seems to be applied also (clear text, but zooming into the horizontal ruler reveals some artifacts), saved as JPEG with a high quality, a white border at the bottom (I added a green box to show it):
A1b.jpg
2. A downsampled image (you can recognize this by the artifacts of the text and the almost vanishing horizontal ruler (right click on the image to enlarge it, and of ). A large white border is added (I've added a green border such that you can see the white area). Zooming in e.g. at the dashes of the ruler shows strong artifacts from the JPEG compression, which impedes the further processing massively:
marked.jpg
See the JPEG artifacts, zoomed by 800% - do you see the dark grey pixels and the different colors of the actuall dashes?
zoomed.png
3. Another file with a yellow box - not explained how you have created it - same white border (again I added the grren border), artifacts, downsampled:
rect.jpg
4. A contour graph, which was obviously build based on an image with JPEG artifacts - see the unclear tick marks at the horizontal ruler at the bottom. It is unlikely that any meaningful measurement can be done based on such images:
boundaries.jpg
As soon as you explain, that type 1. is the used as input, a solution would be rather easy. In opposite to this starting with the noisy type 4. images is very demanding.
You exaplain: "The input are the jpgs images. They are not downsampled." Then why do you post downsampled JPEGs and not the real input? Why do you make the processing much harder (or impossible), by using lossy JPEGs as input?
I've worked with ultra-sound deviced repeatedly. In all cases the screen has been stored lossless as PNG, TIFF or GIF, to avoid the JPEG artifacts. The recognition of the actual data has been easy, because it was at well defined pixels positions. An automatic cropping is very easy also, when the positions are exactly defined.
"Why is it so difficult to understand my query?" Because your explanations do not match the posted examples, because you have a confused idea about cropping, because you do not answer questions for clarifications and ignore suggestions. This is your problem. Nobody but you suffers, if it is not solved. I only want to help you as I do in all other threads.
  5 件のコメント
Stelios Fanourakis
Stelios Fanourakis 2019 年 1 月 28 日
編集済み: Stelios Fanourakis 2019 年 1 月 28 日
I will ask, I don't know if this is possible, since, any exporting I have done so far are in either .dcm or .bmp and come together with all annotations.
Besides, it would be better, if the scanning would be applied on those type of images, 'cause it is something supposed to work for all units.
So more or less, a lot of images going as input to the programe may have annotations.
If the algorith tries to detect only a specific pixel value that corresponds to gray. I guess blue, orange, white and gray they all shall have different values.
Different units may have differently their rulers placed. So, it needs to be automated and trace the gray pixels. I cannot just give Matlab directly the pixel coordinates.
This shall not be automated then.
Guillaume
Guillaume 2019 年 1 月 28 日
Different units may have differently their rulers placed
Can they have different numbers of tick marks?
Can the tick marks be different size?
Can they be on the other side of the image?
Can they be different shape?
Can they be different colour?
It would be very difficult to come up with a truly generic detection algorithm that could cope with all the above, so it's important to know what can and what can't be different from image to image.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage display and manipulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by