Hi, actually i’m working on corner detection and i have decided to code
this as python plug-in into Blender.
What’s going on?
Corner detection is used in 3D scene reconstruction and it is used in many different areas.
I tried to use corner detection to help modellers when they have to trace a logo to convert that logo into 3D object. I wanted to make this step somehow easier.
So the corner detection detects corner in image. My script put verticies into the place of corners. Than you can make edges and faces wherever you need.
These corner detection algorithms detects corners with errors you know…
Little description:
You have to press ALT-P to run script in text editor.
Detection takes 35 seconds on my PC (Athlon XP 1800) - python is slow
You can see original picture with detected corners and
i also put verticies in a object, but they do not fit into the image.
You have to manually put them into right place and also you have to scale them.
I will work on this, but i have to find a solution for it.
If you find it somehow useful, please let me know.
I will be glad you if you could even report your running time…(check console, the final number is your running time)
this box (a 2year old or so p4 3GHz) ran it in 16.25 seconds, not awful.
however, there are obviously ways to speed this kind of thing up, if it is a problem. like we discussed on irc, numerical python (numpy.scipy.org) is a great fit for this, as it provides a nice array interface for matrix manipulation etc. stuff … instead of a couple of nested for loops in py or something, which are easily slow, there is a couple of py method/func calls to library code that is usually implemented in c … and provides many advanced algos too, like gaussian stuff iirc etc
what about the algo, does it do nicely what you targeted? i did not fully understand the result yet, got red spots in weird places in the image that is shown in the image view :spin:
To algo:
Thank you
Algorithm makes some mistakes, there are some options that have to be set for every specific image like magic constant k in range 0.1 - 0.20 and gauss sigma (0.5 - 3.0 range)
I will make GUI if it will be useful for somebody.
I will look at numpy.scipy.org but i can easily recode this into C.
I have originaly implemented this in Java and it had running time around 1 second or so…
If you want to speed up your Python code without much work, I would suggest this:
Use Python 2.5, it is about 1.5 times faster than 2.4
Install psyco, and put the following at the top of your script:
import psyco
psyco.profile()
This will give you AT LEAST a factor 3 increase in speed, and for number crunching things even a factor 5-10. Your script will consume more memory, though.
Linux
Fedora:
yum install python-psyco
Others
use apt-get or you preffered tool to install packages
(http://psyco.sourceforge.net/)
Next idea is to implement this:
I would like to put verticies in the same place as red crosses which shows the detected corners. So if you are looking from TOP (NumPad 7) and you have some distance from your background image, you should get verticies in right place…
But i do not know how to implement this…If anyone knows, let me know
This implemented algorithm is called Harris corner detector and it can’t detect obtuse angles, but i’m working on reimplementation of detector that was developed at my university and it detects according angles, so when i get more time (i need month to finish semester), i will work on it and i will write you