本文介绍了opencv中的图像有效性检查(cvImage)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我有以下代码进行图像验证:
Hello
I have following code for image validation:
sprintf(imageFileName_jp2, "%s\\image_%03d.jp2", fileMenu.m_logPath, tmp_no);
cvImage = imread(imageFileName_jp2, IMREAD_COLOR);
if (cvImage.data == NULL)
continue;
如果图像不适合阅读(当某些图像数据由于通信问题而不完美时),我想忽略图像。 br />
但是,imread()需要时间并且会使代码变慢。
还有另一种方法可以验证图像?
谢谢。
If an image is not suitable to be read (when some image data is imperfect due to communication problem), I want to ignore the image.
But, imread() takes time and it makes the code slow.
Is there another method to validate the image?
Thank you.
推荐答案
Field Size (bytes) Description
APP0 marker 2 FF E0
Length 2 Length of segment excluding APP0 marker
Identifier 5 4A 46 49 46 00 = "JFIF" in ASCII, terminated by a null byte
JFIF version 2 First byte for major version, second byte for minor version (01 02 for 1.02)
Density units 1 Units for the following pixel density fields
00 : No units; width:height pixel aspect ratio = Xdensity:Ydensity
01 : Pixels per inch (2.54 cm)
02 : Pixels per centimeter
Xdensity 2 Horizontal pixel density. Must not be zero.
Ydensity 2 Vertical pixel density. Must not be zero.
Xthumbnail 1 Horizontal pixel count of the following embedded RGB thumbnail. May be zero.
Ythumbnail 1 Vertical pixel count of the following embedded RGB thumbnail. May be zero.
Thumbnail data 3 × n Uncompressed 24 bit RGB (8 bits per color channel) raster thumbnail data in the order R0, G0, B0, ... Rn, Gn, Bn; with n = Xthumbnail × Ythumbnail.
此外,您还可以检查合理的价值。
更多细节请参见 []。
这篇关于opencv中的图像有效性检查(cvImage)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!