Image processing with C++ [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I have a college assignment where I need to do basic image processing such as opening an image, re-sampling, scaling and some pixel connectivity based operations.
Is there any library to make things easier such as jpg viewing and enabling pixel level accessing? Will OpenCV be a good option if so what are the libraries that I should be using?
(I do not want to directly call library methods to do them as this assignment needs to be done some what manually)
Thank you in advance.

I suggest you use ImageMagick to convert your images to PBM/PGM or PNM format (as described here) then you can easily read the images in in C++ and write them out in the same, very easy format which is just
P1 (or P2-P6)
width height (in ASCII text)
pixel pixel pixel pixel ...
pixel pixel pixel pixel ...
That way you can concentrate on the image processing and pixel connectivity rather than worrying about run-length encoding, palettes or JPEG DCTs etc.
To convert a JPEG to PNM just use ImageMagick's convert tool
convert image.jpg image.pnm
or a TIF to PPM
convert image.tif image.ppm
If you want NetPBM formats P1-P3 which have ASCII pixel data rather than binary, use the option -compression none with ImageMagick's convert command, i.e.
convert image.jpg -compresssion none image.pnm
whereas if you want NetPBM formats P4-P6, with binary pixel data, leave off the -compression none parameter:
convert image.jpg image.pnm

Related

Recommendation of OCR software to face this recognition case [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 12 months ago.
Improve this question
I have to recognise text in a picture like this:
Image to recognise
I have tried Tesseract, but I am not very happy with the results.
Could you recommend me any software that could be more accurate in "text recognition on image" instead of "text recognition on document"?
Thanks in advance
Don't expect the Tesseract to work out of the box. This image needs some work before it is put to Tesseract.
I would do following preprocessing:
blur the image to remove some of the digital noise
adaptive thresholding with suitable parameters
correct image
colors to provide white background and black text
this should be easy operations just invert the colors if necessary
run Tesseract with correct language files (italian, I guess?)
These preprocessing steps are really easy to program by hand, but of course there is plenty of libs with this capabilities.
As a starting point see this: Preprocessing image for Tesseract OCR with OpenCV
I don't know of any ready made software that would do text extraction on your specific image without a lot of additional configurations, but you can probably improve your Tesseract results
You can try to treat the image so it's easier for Tesseract to recognize it, use tessedit_write_images true to see your image after Tesseract does it's automatic adjustments
It probably isn't the best so you can do the adjustments yourself with the many libraries/programs available, your goal should be to transform it to a black on white text image, with as little noise as possible
For this read: ImproveQuality
You can also try to train Tesseract for your specific data, but this will require a lot more work, and large amounts of training data, read: TrainingTesseract 4.0

reading black and white pixels as an array from jpeg in c and c++ [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
im trying to learn how to read a jpeg image as an array of pixels in c++ or c. so far ive learned that i have to include a outside library such as libjpg.h.
ive been told that the jpeg is formated in a RGB structure where each pixel gives 3 values. is this true? and if so how would i read values for a purely black and white image?
the purpose of this question is that i am trying to assign a pointer to the top right corner of a white squre in a black picture.
if someone could show me how to read out the vaules that are given to me for this situation so i could assign this pointer i would be greatful.
Let's suppose you run with libjpeg. You'll allocate a buffer and then call jpeg_read_scanlines a sufficient number of times to get all of your decompressed image data into memory. You can read scanlines (rows) individually and reformat them as needed. If the image is grayscale, the RGB values will all be equal, so you can just read one of them.
Paul Bourke's site has some pretty good usage examples of libjpeg.

RGB to YUV using GLSL [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I am looking for sample GLSL fragment shader code that can convert RGB frame (say pixel format as ARGB) to YUV (say YUV420).
Imagine an RGB frame of size 1920x1080. I like to use fragment shader to convert it to YUV frame.
Can you point me to code that can be compiled and run on UBuntu box?
For future reference, a bunch of colorspace conversions in GLSL shaders can be found in Gstreamer gst-plugins-gl codebase :)
First, you should know that your question is poorly phrased. Nobody is going to write you sample code. You can use a search engine (or even search this site) for code to convert from RGB to YUV.
I have written an answer similar to what you're looking for here. It converts from RGB to YIQ, does some shifting of the hue and converts back. You can use the Y'CbCr matrix for the color conversion instead of YIQ, if that's what you need.
It doesn't down-convert to 4:2:0, though. That should be easy enough to do, though. Once it's in Y'CbCr format, you can downsample the appropriate channels as you see fit. I recommend doing a low-pass filter on those channel first to avoid aliasing artifacts.
I don't work with Linux, so haven't tested on Ubuntu. Good luck.
This link has a YUV 4:2:2 v210 to RGB implementation using a compute shader GLSL. YUV 4:2:2 v210 --> RGB GLSL source code

How does tinypng.org compress PNG files? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
http://tinypng.org/ is a great service, they optimized my png images by ~67%. How does their service work? How can they minimize size and quality of pictures still remains the same?
The answer's right on that web page:
When you upload a PNG (Portable Network Graphics) file, similar
colours in your image are combined. This technique is called
“quantisation”. Because the number of colours is reduced, 24-bit PNG
files can be converted to much smaller 8-bit indexed colour images.
All unnecessary metadata is stripped too. The result: tiny 8-bit PNG
files with 100% support for transparency. Have your cake and eat it
too!
It turns 24-bit RGB files into palettized 8-bit ones. You lose some color depth, but for small images it's often imperceptible.
You can do the same thing manually on the command line with this awesome tool:
http://pngquant.org/

OpenGL: navigating a 3D scene (a room with walls) with collision detection [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
For a school project, I have to be able to move inside a 3D scene like a room and implement collision detection with its walls.
I'm looking for tutorials and bibliography that deals with the subject.
I already have the Redbook and Opengl's Superbible.
Simplest thing that comes to mind is using a Colour Map of the top view of the room.
Basically you create a bitmap using only 2 colours:
One that will determine your 'walls'
One for 'everything else'
Here are a few articles found by googling:
2D Collision Detection using a Color
Map
Collision Detection and Bounce
Calculation using Colour Maps
They use different languages, but that's irrelevant, the principle is the same.
Once you've got the colour map, you will have ratio to convert from x,z in your 3D to x,y in the 2D colour map. In theory, if you want, you could generate the colour map at runtime, rendering an ortographic top view. You would render just the walls using the fact that the walls will probably by the 'tallest' objects in your scene.
HTH
Those guys are pretty good at it: http://www2.imm.dtu.dk/visiondag/
You can try and contact them. I took a course there but I don't have the exact references here.
Here there is a course links with tutorial:
http://www2.imm.dtu.dk/~bdl/virtualreality.html
There is an entire book on Real-Time Collision Detection.
Before you write your own collision detector from scratch, you should consider implementing the rest of your setup and plugging in an existing library. It is much easier to develop a program, if you have a correct result to compare to.
The GAMMA research group has developed a number of collision detection packages that are popular in robotics and more. You or your institution may ask them for a package for non-commercial or academic use. One of these packages, PQP, is the inspiration for Yaobi, an open-source C++ library.
Yaobi and PQP are both easy to use, requiring only a bunch of triangles to model a geometry.