Ask Your Question
0

OpenCV_annotation tool

asked 2018-07-02 10:56:22 -0600

updated 2020-10-04 16:24:17 -0600

Hi I am trying to use opencv annotation tool for small pieces of high-resolution satellite images. each of my positive images is 14*14 or even smaller. these images are too small to mark the object when using annotation tool. I want to know if i can zoom the picture in the annotation window? Thanks!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2018-07-03 00:23:21 -0600

berak gravatar image

no, unfortunately you cannot arbitrarily "zoom" into your image there.

the annotation tool has a scaling factor, but this is for the opposite case (making large images smaller)

however, as a crude hack, you could try to change the resizeFactor here from int to float, and recompile the app. this would allow you to use fractional scale factors, and call it like:

opencv_annotation -i=/data/testimages/ -a=/data/annotations.txt -m=1 -r=.25

(this would upscale your images by a factor of 1.0/0.25 = 4)

edit flag offensive delete link more

Comments

1

I wrote a small java fx programm for this(i needed resizing / zooming / scrolling): https://github.com/holger-prause/imag... No warranty.

holger gravatar imageholger ( 2018-07-03 03:59:56 -0600 )edit

Thanks for your answering, I am using python to finish the work and I could not find the file opencv_annotation.cpp. Could you please tell me how I can modify the file?

826173081@QQ.COM gravatar image[email protected] ( 2018-07-03 08:52:36 -0600 )edit

please look at the link, in the answer, again.

berak gravatar imageberak ( 2018-07-03 08:59:50 -0600 )edit
  1. Locate the file(i found it with find command) /home/holger/opencv-3.4.1-src/apps/annotation/opencv_annotation.cpp
  2. Change the file
  3. Recompile with cmake

Or just click the link provided by berak - https://github.com/opencv/opencv/blob... It includes the line and also the path to the file

holger gravatar imageholger ( 2018-07-03 09:01:08 -0600 )edit

Thank you very much! I am really appreciated. Can I ask you another question? my code is image = cv2.imread('.tif',0) faceRect = cascade.detectMultiScale(image, scaleFactor=1.1, minNeighbors=1, minSize=(1,1)) But I got this error. error: (-211) The total matrix size does not fit to "size_t" type in function cv::setSize I am wondering if it's beacuse this tif image is too large? Do you have some suggestions? Thanks!

826173081@QQ.COM gravatar image[email protected] ( 2018-07-05 11:02:05 -0600 )edit

loading recources can and will fail (aka murphy's law). and especially python noobs NEVER seem to get it.

if using imread(), add a check like : if np.shape(img) == (): # failure, do something

berak gravatar imageberak ( 2018-07-05 11:35:03 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-07-02 10:56:22 -0600

Seen: 2,775 times

Last updated: Jul 03 '18