Qimage Grayscale Format Indexed8

Автор:

QImage tmpImg( (uchar.)newImg.GetData, width, height, width, QImage::FormatIndexed8); I'm interested in this issue. Would you mind dumping your raw data to a file and posting it here? I'd like to try it later. How are you loading the QImage with the grey image data? QT doesn't have a greyscale image type, only a bilevel type. You can either create an RGB image with R=G=B=grey. Or more preferably use QImage::FormatIndexed8 and create a colour table where each entry has the same value as the index.

About QtOpenCV

  • QtOpenCV provides some helper functions to converting cv::Mat from/to QImage.

  • QtOpenCV provides a opencv.pri file which can be used to integrate OpenCV2 or newer to qmake-based project. Microsoft autoupdate mac keeps opening.

cv::Mat <> QImage

  • Download and copy the cvmatandqimage.cppcvmatandqimage.h and opencv.pri to your project's source tree.

  • Then take advantage of the following API to converting data between Cv::Mat and QImage.

  • In addition, two other functions are provided which works more efficient when operating on CV_8UC1, CV_8UC3(R G B)CV_8UC4(R G B A), CV_8UC4(B G R A) or CV_8UC4(A R G B).

OpenCV2 Integration

If your want to use OpenCV in your qmake based project, you can download and put the source files to any directory you wanted,then add following code to your .pro file.

or you can simply add following line to your .pro file:

As you can see, nothing else needed to do for non-windows users.

Notes for Windows User

To make opencv.pri works for your, you need to create an opencv.prf file, then move the .prf file to %QTDIR%/mkspecs/features/.

Method 1: Create and copy the opencv.prf by hand

You can use a textedit to create the .prf file. The contents of .prf file more or less looks like this:

Qimage

Then you can copy it to %QTDIR%/mkspecs/features/.

Method 2: Take use of the helper script

If you have installed python, the helper script opencv_prf_generator.py can be used to generate and install the opencv.prf file.

Some thing you need to know

Channels order of OpenCV's image which used by highgui module is B G R and B G R A

The manual of OpenCV says that,

  • cv::imwrite()

Only 8-bit (or 16-bit unsigned(CV_16U) in case of PNG,JPEG2000,and TIFF) single-channel or 3-channel(with 'BGR' channel order) images can be saved using this function.

It is possible to store PNG images with an alpha channel using this function. To do this, create 8-bit (or 16-bit) 4-chanel image BGRA, where the alpha channel goes last.

  • cv::imread()

In the case of color images, the decoded images will have the channels stored in B G R order .

Note: If you don't care opencv_highgui module, you can always use the same channels order as QImage, which will be slightly fast.

Data bytes order of QImage

  • In Little Endian System
  • Ins Big Endian System

How to swap channels?

  • In OpenCV
  • In Qt

Swap r and b channel of QImage

If you need to convert between audio formats, Fission for Mac can do that too. Rapidly export or batch convert files to the MP3, AAC, Apple Lossless, FLAC, AIFF, and WAV formats. The app has all your audio needs covered. Finally, simple audio editing has arrived. Find the best programs like Fission for Mac. More than 14 alternatives to choose: Ocenaudio, Amadeus, X Lossless Decoder and more. AWS Lambda, Serverless, Cloud Functions for Firebase, Azure Functions, and Google Cloud Functions are the most popular alternatives and competitors to Fission. 'No infrastructure' is the primary reason why developers choose AWS Lambda. Alternatives to Fission for Windows, Mac, PortableApps.com, Linux, iPhone and more. Filter by license to discover only free or Open Source alternatives. This list contains a total of 25 apps similar to Fission. Top 5 alternatives to fission for mac. Fission 2.5.0 Released October 29, 2019 (Release Notes) For MacOS 10.12 or higher. What People Are Saying About Fission “Nearly every modern Mac user has a reason to muck with musicRogue Amoeba gave us amateurs an easy, inexpensive way to edit our audio files”.

If the depth of the image is 32, the following function can be used too.

Common Image Data Range of OpenCV