Removing horizontal bands from image with opencv - c++

I´ve got a problem with a video image that im trying to capture and process in my pc.
The thing is that the video camera is wireless, so the video images that im getting have horizontal bands due to interferences or whatever it is causing this.
What i want to do is to try and remove the horizontal bands from the image to try to get the clearer image possible.
Is there any algorithm or method to do this? The algorithm has to be adaptative because the bands are not always the same. Im trying to accomplish this with opencv in c++, but I´m having trouble finding anything in this subject.
Thanks.

you should figure out what the real cause of these bands are and fix it. for any kind of image processing, bands like that will minimise what you can actually do with an image. you won't be able to replace the bands with what should have been there.

Related

Confusion on Softening Mask Edge in AECS6

So I am fairly inexperienced with After Effects. But I am making a title for a video project and am having a hard time figuring something out. I have some text that slides over, and appears once it is in the masked area. However this is a very hard edge and doesn't look the best. How do I soften that edge? I tried making another shape and blurring it and then masking that over the other shape but that didn't work. I tried Googling but it was full of people saying you cannot feather a shapes edges in AE.
I would use the mask in my image directly with the feather option but then that mask moves with my image, and that's not what I want.
So I learned that you can just make an image in photoshop that does whatever you want it to do and just use that.
The masks feathering moves your image? Can you put up a screen recording of the problem?

Finding Line Spacings in Thresholded Image - R/C++ Image Processing

Hello Stackoverflowers,
I have a question about Image Processing. I will give a short introduction about my project, clear things up and ask my question.
I use R now, with EBImage library. After that I will write that code on C++.
In material analysis, the microstructural analysis are done in sake of understanding the structure of steel. It gives some hints to the analyzer.
My duty is; finding the line spacings in the image. I will explain it by images.
Image is taken from: https://de.wikipedia.org/wiki/Perlit_(Stahl)
I will post a collage image, because I cannot upload images more than 2.
First photo is the image of perlit microstructure. Second photo is thresholded image after preprocessing. Third photo is what I made on Paint to show you the regions that I need to find.
Photo, "Pre-processing" is done by doing:
Grayscaling the Image.
Closing Filter by 7x7 Gaussian Kernel
Dilating Filter by 3x3 Box Kernel
Median Filter 7x7
Thresholding Image
Black and White image in collage photo is the result of these steps.
Collage Photo of Perlit
Now, if you look this image, there are some line spacings shown by red pencil via Paint, in the 3rd photo. I want to make a segmentation to show them painted.
You can clearly see that I got rid of tiny vertical lines, made clear segments.
I need help in segmentation. I am currently reading lots of computer vision and image processing books, but unfortunately I couldn't find a good solution. In EBImage, there are some functions but "bwlabel" or "watershed" didn't help me a lot.
The segmentation will be done in this image horizontally. But there would be an image with gradiental line spacings.
I am not asking this question for ready copy-paste answers. I really want to learn how to do this. Any help will be highly appreciated.
Thank you very much for reading my questions.
There seems to be a horizontal pattern in the structure.. is it always like this? Have you tried exploiting this correlation? Maybe extract vertical histogram (histogram over rows of pixels), and find maximas?
I reread your question, already saw that you are taking into account the horizontality. Knowing this, if you just want to paint the red regions, then you already have a good binary mask to paint them.. or you dont want to paint the small white patches between the dark structure?
Cheers

Capture a specific location of an image using OpenCV

I am trying to organize my trading card collection digitally and am working on building a scanner using ocr to detect the names of my collection.
I need to use a webcam to snap a single image of each card in question. Snapping the image doesn't seem to be to difficult, but I need help determining how to get OpenCV to capture only a specific part of that image for OCR to work with. I'm trying to capture just the text portion of the image so that the artwork on the cards doesn't interfere with the OCR.
If my card will be placed in the same physical location each time, is there a way to get OpenCV to take an image and focus on just the area of the image that I'm interested in.
Thank You
Sour Jack
I am not sure I understand the problem. Do you want to use your OCR algorithm always on the same portion of the snapshot? If so, you can try something like:
roi = img[y:y+height, x:x+width]
There is more information here: http://answers.opencv.org/question/29260/how-to-save-a-rectangular-roi/

Assigning functionality to a image using video feed as input

as a semester project me and my group had to create a game. We decided to make a 2D racing game, how is it different from a normal 2D racing game is that we use image processing to control the cars. The camera detects the users hands and based on their location it moves the car. So far we were able to do most of the code, except one part..
My question is, how do we assign the image (car) functionality based on the location of the hand.
We are using OpenCV, and it did everything so far, but as for functionality to the image, we couldnt figure anything out. I heard that SDL is very good when trying to make a 2D game such as this but I couldnt make it work with OpenCV.
I need suggestions on how to assign functionality to an image OR maybe change the image into something else sprite/object making it easier to assign functionality. I am open to any suggestions. I have tried doing this using only OpenCV/C++ methods, such as waitkey and mouse events but they will not work when we need the data from the video input.
Thank you

'creating' images effectively

I'll first tell you the problem and then I'll tell you my solution.
Problem: I have a blank white PNG image approximately 900x900 pixels. I want to copy circles 30x30 pixels in size, which are essentially circles with a different colour. There are 8 different circles, and placed on the image depending on data values which I've created elsewhere.
Solution: I've used ImageMagicK, it's suppose to be good for general purpose image editing etc. I created a blank image
Image.outimage("900x900","white");
I upload all other small 30x30 pixel images with 'read' function.
I upload the data and extract vales.
I place the small 'circle' images on the blank one using the composite command.
outimage.composite("some file.png",pixelx,pixely,InCompositeOp);
This all works fine and the images come up the way I want them too.
However its painfully SLOW. It takes 20 seconds to do one image, and I have 1000 of them. Surely there must be a better way to do this. I've seen other researchers simulate images way more complex and way faster. It's quite possible I took the wrong approach. Maybe I sould be 'drawing' circles instead of 'pasting' them or something. I'm quite baffled. Any input is appreciated.
I suspect that you just need some library that is capable of drawing circles on bitmap and saving that bitmap as png.
For example my Graphin library: http://code.google.com/p/graphin/
Or some such. With Graphin you can also draw one PNG on surface of another as in your case.
You did not give any information about the platform you are using (only "C++"), so if you are looking for a platform independent solution, the CImg library might be worth a try.
http://cimg.sourceforge.net/
By the way, did you try drawing the circles using the ImageMagick C++ API Magick++ instead of "composing" them? I cannot believe that it is that slow.