简体   繁体   中英

Some logic to extract image pattern from video using OpenCV

在此处输入图片说明 I am familiar with openCV, a powerful open source library and using that I am dealing with farm industry project where a mouse will be injected with drug , and its been kept on so called a stage which is surrounded by cylinder with painted strips of successive white and black. So i need to find out how many times the mouse will rotate its head to words the rotation of the cylinder . (its because it has got hang of drug) . How can i achieve this any opencv experts can help me out there.

I have added an image below

Seems an interesting one, these are my preliminary suggestions...

  1. Depends on the resolution of the camera and how far your object (mouse) is from the camera...coz mouse is a small object so the image of the mouse need to cover good number of pixels in the image to differentiate head movement...
  2. I don't think the mouse will stick to one position..it will keep moving in the cage...so you need to track the mouse...
  3. At every position of the mouse you need to find the position of the head with respect to the body....that you can do using template matching (create templates of the head of the mouse)

    Hence more info and some sample pictures are necessary to get the clear idea of the scene

EDIT AFTER IMAGE UPLOADED

  1. since the camera is fixed hence create a circular region of interest...so that only movement inside this circle concerns you and not the moving cylinder outside the circle 像这样

  2. subtract the present frame from the previous frame (frame differentiation) and store the absolute of the difference in an image.

    absdiff(frameNow,framePrevs,diffofFrames);

    threshold the diffofFrames as required to get the current position of the rat...

  3. Now the task is easier if the image clearly shows its nose...since the nose has a pointed shape it can be detected by some template matching....however from the image you have given its difficult to make out the nose against a black background...However I can only suggest you the following process... 在这里显示 green circles denote the tip of the nose...all I am trying to do is to get orientation of the head wrt the body....for good results you need to have good images...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM