How to remove bounding box while saving a file? - python

I have a frame running with a small bounding box on the forehead. While if some certain condition is met the image must be saved. So when I use cv2.imwrite(filename,frame) , it saves the current frame but what I need is an image that doesn't contain a bounding box.
(i.e) My live webcam feed must have a small bounding box at my forehead but when I save that image I the bounding box must not be present in the final image that is saved into the directory.

Just keep 2 copies of same frame, one with bounding box and one with clean image. when certain condition is met save the clean one. I think that it is much easier and cleaner solution than removing the bounding box.

Related

'Label' and 'Regionprops' function unable to distinguish all regions even though the bounding pixels are very similar

so I am trying to create an algorithm that is able to distinguish bounding boxes for different images, and after several steps of image processing I was able to get a fairly accurate bounding box. I used this binary image to find labels of each box, and for some reason the first box remain undetected even though it has very similar shape to its adjacent boxes. The labeled boxes are shown below. Does anyone know the cause of this? [Binary bounding box as an input to label and regionprops][Labeled boxes]
I expected all the boxes to be labeled as they are closed region and its shape is very similar to other boxes found

YOLOV5 bounding box coordinates and assigning variable

I just want to ask a question about assigning a variable to the bounding box detected in yolov5 to input each bounding box in one cell. Is it possible to assign a variable in bounding box ? Or there is an alternatives ? Thank you for your comments at advise in advance. What i want to do is to assign each bounding box in excel to make sure that it will always appear on that cell in excel when the object detection starts

OpenCV Python: retrieve rectangle main area from image then crop image

I'm trying to isolate the main area art from Pokemon cards and crop them. For example,
I want to extract the main area, as seen in the bounding box below.
I want to use the OpenCV in Python for the task. I've tried out shape detection and corner detection, but I can't seem to make them work as intended, and they seem to pick up anything but the main area that I want to extract.
I can't hard-code the bounding box because I want to process many cards and the position of the main area is different per card.
What are the steps needed to extract the main area and save a png file of just the main area?
If the area of interest is always contained inside a somewhat contrasted quasi-rectangular frame you can try your luck with a Hough transform, keep the long horizontal and vertical edges (obtained separately) and try to reconstitute that frame.
To begin, process a small number of cards and observe the results of Hough and figure out which systematic rules you could use to select the right segments by length/position/alignment/embedding in a larger frame...

How to label image without using bounding box?

I'm trying to create custom dataset using my own images. This images I cropped from logs data such as below:
https://drive.google.com/open?id=1x0oWiVZ9KOw5P0gIMxQNxO-ajdrGy7Te
I want it to be able to detect the high vibration such as below:
https://drive.google.com/open?id=1tUjthjGG1c23kTCQZOgedcsx99R_a_z3
I have around 300 image of the High Vibration in one folder. the picture is like below:
https://drive.google.com/open?id=1IG_-wRJxe-_TOYfSxHjRq5UBWMn9mO1k
I wanted to do exactly like https://towardsdatascience.com/how-to-train-your-own-object-detector-with-tensorflows-object-detector-api-bec72ecfe1d9. IN this example image dataset was hand-labeled manually with LabelImg.
However I don't see why I need to draw box for images that only have one object in it and can have the frame of the image as the bounding box.
Please advice how I can create data set and processing the images without manually drawing the bounding box (since the images consist of one object), and how to draw bounding boxes in batch for image that contain one object(i.e. having the frame of the image as the bounding box)?
It sounds like you want to do 'image classification' as opposed to 'object detection' -- it may be easier to make a script that generates xml files, containing the image's width and height as bounding box dimensions, as opposed to using labelImg.

OpenCV get subimages by mask

Have you any ideas how can I with python and OpenCV get subimages on original image by that mask? I need separated subimages of every white area.
Because it's not rects it's hard to get them separated.
I think you are looking for connectedComponentsWithStats(), which will give you connected components (i.e., one label per white area). The result will be a labeled image with a separate label for each component.
From this, it is easy to extract the part of the image with a specific label.

Categories