I want to extract certain part from the image
I am running Python 3.9.12 with CV2 4.6.0 on Ubuntu 22.04.1 LTS
(From) The original pic:
https://ibb.co/RcZ7ntL
(then) The pic want to locate(I want to extract the red part only):
https://ibb.co/dGBfqXx
(the desire pic/output) : https://ibb.co/j5h501f
I've tried searching for a solution on StackOverflow, but I didn't find anything remotely similar. And I search that most of the tutorial is teaching finding the same image in image.
In case someone doesn't want to load too many pics, I put them as link instead.
so my main issue is that not sure how to cut them into the picture I want
this is after I manual cut to the part I want, then I can do OCR recognize image to text
the desire pic/output : https://ibb.co/j5h501f
the pic I success detect the image to text: https://ibb.co/mv9WTpW
I come up a idea [solution A]
that using openCV bounding box cut every sticker separated https://ibb.co/1Q9DnLJ
cause every line is fixed distance (ex: CA74C8), then give cv the correct scale to cut
how to make [solution A] step 1 work? I have tried for half of a day but still stock on this, I need a hand thanks
You can do the reverse task:
run your OCR first, since it will find all texts in the image for you.
If you you tesseract, it will send you all the text AND the locations/boxes where the text is found.
like here:
Related
I am working on one project which is based on pathology laboratory, They are giving strip image which i have attached below.
what i want is i want to get all 11 colors(in rgb or hex) of that image in sequence using python(flask) only.
I have tried PIL and some other library of python, also i tried to find its solution on stackoverflow but that couldn't solve my issue.
Any kind of help would be appreciated.
https://i.stack.imgur.com/6zpod.png
In the below input image I need to detect the highlighted icons using openCV in python. The biggest challenge here is the icon to be detected are rotation variant which means they can be rotated in any direction. But still the algorithm needs to detect as shown below. I tried with template matching but it wasn't able to detect properly. I am newbie to image processing so any ideas/thought will be very much helpful.
I am trying to extract logo from the PDFs.
I am applying GaussianBlur, finding the contours and extracting only image. But Tesseract cannot read the text from that Image?
Removing the frame around the letters often helps tesseract recognize texts better. So, if you try your script with the following image, you'll have a better chance of reading the logo.
With that said, you might ask how you could achieve this for this logo and other logos in a similar fashion. I could think of a few ways off the top of my head but I think the most generic solution is likely to be a pipeline where text detection algorithms and OCR are combined.
Thus, you might want to check out this repository that provides a text detection algorithm based on R-CNN.
You can also step up your tesseract game by applying a few different image pre-processing techniques. I've recently written a pretty simple guide to Tesseract and some image pre-processing techniques. In case you'd like to check them out, here I'm sharing the links with you:
Getting started with Tesseract - Part I: Introduction
Getting started with Tesseract - Part II: Image Pre-processing
However, you're also interested in this particular logo, or font, you can also try training tesseract with this font by following the instructions given here.
I want to take a screenshot of whole screen in python which is doable(feasible) to me. But if i want to take screenshot of a desired clipped area like the picture shown below means first of all, user should select(clip) a region using mouse pointer and then take screenshot of that area. So i want to say that how to clip a portion of an image in a clipboard?
NOTE: I have found some packages like "clipboard" and "pyperclip" but i couldn't understand how to clip an image? Help me
I got a code but it shows to clip only text. What modifications should be made in it to clip a desired area of an image.
import clipboard
clipboard.copy("abc")
text = clipboard.paste()
print(text)
I would find a python module that allowed you to edit image files, or use a binding to an external program. A tool like pyperclip will enable you to get at the image in python, you will then have to edit the image yourself using a module or something else.
I want to sift through a collection of video files looking for a certain logo, and then record the 10-15 seconds leading up to it. I can recognize the logo by checking a certain pixel color.
How would you do it? Is there software or a python package that allows me to extract those chunks of files and write those into a new video?
What i have done so far:
I have found a library that is able to convert a video into a series of BMPs. What the programs. Its called pyMedia: http://pymedia.org/tut/src/dump_video.py.html and the reverse: http://pymedia.org/tut/src/make_video.py.html
So thats pretty neat. However its only working with python 2.3, not with python 3.
Seems like :
d= e.encode( yuvFrame )
fw.write( d )
writes a BMP file. So how do i look in for a certain colored pixel or logo in a BMP file and put it together? Thats what i cant get working somehow. Maybe someone can help me with this.
edit:
let me show you what i have done so far:
from PIL import Image
im = Image.open("bride.bmp")
i=0
width= 10
height = 10
top= 461
box = (left, top, left+width, top+height)
croppy=im.crop(box)
if (mycolor in croppy.getcolors()):
print "Logo found"
My logo has a certain color, so this looks for the pixel and prints logo found if the pixelcolor is found. Didnt really want to make a classifier for that.
Using perhaps OpenCV or another package -- essentially, you want to train a classifier to identify your logo and then feed it the bitmaps from your video. When it identifies the logo, then you trigger the code which captures the previous 15s of video.
This is a very detailed answer about how one might do this in Python General approach to developing an image classification algorithm for Dilbert cartoons