Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

ba-san/Count-Annotator

Repository files navigation

Count-Annotator

Note: This repository has a successor Count-Annotator2.

You can prepare annotated images for object counting and csv file which contains each point's location.
This can be worked on both Linux and Windows.

Set up

It is recommended to use Python3.7.
1.download the repo.

git clone https://github.com/ba-san/Count-Annotator.git  

2.install packages.

pip install -r requirements.txt    

How to use

converting videos into images

If you won't use video as input, you can skip this section.
Most of the scripts for this section are owe to this page.

  1. Go to the "Count-Annotator" directory.

  2. setting path and frames in video2img.py
    (you can use default setting for demo. the demo video is gotten from this page)

save_frame_range('./videos/park.mp4', #input video
                 0, 10000000000, 100, # start, end, frame
                 './images/', 'park') #output directory and output images' prefix
  1. run by python video2img.py

annotation

  1. Go to the "Count-Annotator" directory.

  2. setting up an annotating directory

folder = "images" #input images in this directory
  1. You can set the size of cropped images here.
	while y < img.shape[0]/300.0:
		while x < img.shape[1]/300.0:
							
			cropped = img[(y-1)*300:y*300, (x-1)*300:x*300]

In this case, cropped image size will be 300px x 300px.

4.run by python annotation.py
move mouse for dragging a pointer and push keys below.

C -- count object (moving your mouse on top of object first)
E -- stop annotating. DO NOT END IT BY TYPING 'Ctrl + C' OR ANY OTHER WAYS!!
B -- go back JUST ONE act
Esc -- clear image and start it again
Enter -- go to next image

Note: just_crop.py is a script just to crop images, without annotation.

Output

You can get both a csv file and annotated images in 'OO_cropped' directory as shown on the top of this page.

About

annotation environment for object counting

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages