how to detect shape in a image with php?

巧了我就是萌 提交于 2019-12-21 17:50:02

问题


I have to detect 'star' like shape in a image with php.Also the star is not fixed and may be at other position next time.I cannot use any external software or library.I have tried all methods like edge detection and grayscaling but all in vain.this is the image:

the main problem is I cannot clear the background. if image background is cleared than i can read all pixels color row wise as well as column wise and detect.please help me.this is the image after brightness_filter and edge detection.


回答1:


For this particular image would suggest to perform a low amount of lowpass filtering (Gaussian blur) to attenuate those lines. That should work because thin lines have high frequencies at their transistions. And then you can try increasing the contrast and the brightness.

I just did a quick test and the result is something like that

Then just calculate the cross-correlation of your resulting image with images of different stars.




回答2:


If the star itself isn't scaled or rotated, then you should be able to detect it from the 2D convolution of a clean star image with your source image.

If you are trying to find stars with different scales and rotations, it would probably be better to clean up the image with an erosion filter, then use edge detection and a Hough transform to find the edges.



来源:https://stackoverflow.com/questions/19427836/how-to-detect-shape-in-a-image-with-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!