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
Related
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
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.
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
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to try and make a program that can identify pictures. Since I'm using the pixel colors as input, should I have 3 inputs for each pixel in the image? (RGB values)
Color images are normally defined by at least three channels: R(red), G(green) and B(blue). You may also have alpha and all sorts of other channels. So yes, for one pixel you will have 3 inputs.
You have to clarify what exactly "identify pictures" entails.
"Identify pictures" is a very vague term.
You might want to take a look at something like OpenCV for handling image data. Within that library, the Mat structure provides very transparent pixel storage and access.
As far as semantics go, the function doing the "identification" would ideally accept an image object as an input, as opposed to image channels.
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/