![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/995055/image.jpeg)
Read and detect font from RGB image
5 次查看(过去 30 天)
显示 更早的评论
Hey,
I try to detect textures from objects by the help of a color changing sensor. Depending on the underlaying texture, the stress of the surface of my sensor changes and thereby the color changes (no stress = red, more stress = green, much stress = blue). As you can see in the uploaded imaged, the texture is more or less "clearly" visible. Now I want to write a code that creates a binary mask which shows the texture. In the example that you can see here, I want to detect the letters "Grol" in the same font as seen on the picture, so if everything would work out as planed I would have a binary mask with black pixels on a white background shaping the word "Grol" in the handwritten-looking font.
I tried different ways to realize this. One by converting the picture into RGB, HSV, or Grayscale and analyzing the edges of the individual image channels (R/G/B or H/S/V). By morphological operations (erosion, dilatation) I wanted to solve my problem. However, several edge detection algorithms (canny, sobel, roberts, prewitt, log, zerocross) did not end up in the results I wanted. Mostly only a part of a letter is recognized, sometimes none are detected. Even after playing around with the parameters of all algorithms (structuring elements, gradients,...), I was not able to solve the problem.
My second approach, to detect only a specific color space and binarize pixels as 1 or 0 belonging to the fact if they are in, or out of the colour space, did also not work. The problem hereby is, that for example the background color on the picture I uploaded is dark green, but also parts of the font (bottom of the letters, have that green tone).
My question now is, whether you know another way to analyze images? Is there a function, or algorithm to detect such textures reliabley?
I mean as a human I find it very easy to read the writing when I look at the picture. I could trace the binary mask very easily if asked to draw it over the image. If it's so easy for me, then there must be a feature that makes the writing stand out. Am I on the wrong track?
If there are some image processing geniuses here, I would be very happy about help and tips. Many thanks for the help in advance.
Best, Raphael
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/994830/image.jpeg)
5 个评论
DGM
2022-5-13
So it really is strictly a matter of hue shift, and the intensity information is largely a matter of incidence.
Still, at least with this one image, I'm having a hard time getting a better extraction of the logo from the image. One of my points of attention has been the connecting stroke between the O and L. It's proving difficult to actually pick up that subtle, yet plainly visible detail. Some other areas are a bit difficult to manage due to the reflections of the surroundings.
That difficulty aside, the task of converting a tensile strain map to a binarized representation of the logo seems like it would be a challenge. The strain map is kind of a defacto map of edges and corners. If we consider an idealized edge map, how does one back-calculate the original image from its edge map? You might try to integrate or do something, but in this case, it's not really a consistent edge map to think that would work. Not all edges are highlighted. I'm not sure of a good approach. Then again, for the task of object discrimination, there may be a way to utilize the strain map without the need to actually fully recover the binarized logo. I'm not sure.
If you have a few other image examples, maybe I could poke around some more with those.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Modify Image Colors 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!