I'm working on a small personal project that converts images from different formats for ML purposes - specifically with multi-threading in mind.
Initially, everything was working smoothly: PNGs were being converted into JPGs as expected. I then added more images to the test batch which resulted in errors.
Apologies if my grammar is off or if I'm missing any info, I'm heavily sleep deprived as I type this lol.
I attempted to add more image types to the boost::gil::any_image keyword, which did help with the majority of the test batch, but I'm now left with 3 files that will not convert.
Code being run: -> int main()
using namespace boost::gil;
any_image<gray1_image_t, gray4_image_t, gray8_image_t, gray16_image_t, gray32_image_t, gray64f_image_t, rgb8_image_t, rgb16_image_t, rgb32_image_t, rgb64f_image_t, rgba8_image_t, rgba16_image_t, rgba32_image_t, rgba64f_image_t> img;
for (int i = 0; i < f_cache_size; i++) {
std::string tmp_png = R"()" + final_cache[i];
read_image(tmp_png, img, png_tag());
container.png_to_jpg(tmp_png, img, 95);
}
-> Convert.cpp
// Converts PNG files into JPG files
void Convert::png_to_jpg(std::string fileName, boost::gil::any_image<boost::gil::gray1_image_t, boost::gil::gray4_image_t, boost::gil::gray8_image_t, boost::gil::gray16_image_t, boost::gil::gray32_image_t, boost::gil::gray64f_image_t, boost::gil::rgb8_image_t, boost::gil::rgb16_image_t, boost::gil::rgb32_image_t, boost::gil::rgb64f_image_t, boost::gil::rgba8_image_t, boost::gil::rgba16_image_t, boost::gil::rgba32_image_t, boost::gil::rgba64f_image_t> image, int quality)
{
using namespace boost::gil;
std::string jpg = R"(.jpg)";
std::string png = R"(.png)";
fileName = remove_postfix_from_string(fileName, png, jpg);
write_view(fileName, view(image), image_write_info<jpeg_tag>(quality));
}
Error code after attempting to run the program:
terminate called after throwing an instance of 'std::ios_base::failure[abi:cxx11]'
what(): dynamic_io: unsupported view type for the given file format: iostream error
Aborted (core dumped)
Extra information on 3 different image files:
Image:
Filename: rebarchi_ - pog.png
Permissions: rw-r--r--
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: DirectClass
Geometry: 898x677+0+0
Units: Undefined
Colorspace: sRGB
Type: TrueColorAlpha
Endianness: Undefined
Depth: 8-bit
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 8-bit
Alpha: 1-bit
Channel statistics:
Pixels: 607946
Red:
min: 0 (0)
max: 255 (1)
mean: 230.031 (0.902081)
median: 254 (0.996078)
standard deviation: 53.3536 (0.20923)
kurtosis: 4.84342
skewness: -2.35946
entropy: 0.430811
Green:
min: 0 (0)
max: 255 (1)
mean: 220.531 (0.864827)
median: 251 (0.984314)
standard deviation: 60.4584 (0.237092)
kurtosis: 2.50953
skewness: -1.91354
entropy: 0.461063
Blue:
min: 0 (0)
max: 255 (1)
mean: 200.472 (0.786166)
median: 233 (0.913725)
standard deviation: 60.5139 (0.237309)
kurtosis: 1.31362
skewness: -1.62729
entropy: 0.581842
Alpha:
min: 255 (1)
max: 255 (1)
mean: 255 (1)
median: 255 (1)
standard deviation: 0 (0)
kurtosis: 1.6384e+52
skewness: 9.375e+35
entropy: 0
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 226.509 (0.888269)
median: 248.25 (0.973529)
standard deviation: 43.5815 (0.170908)
kurtosis: 4.43874
skewness: -2.3037
entropy: 0.368429
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Matte color: grey74
Background color: white
Border color: srgb(223,223,223)
Transparent color: black
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 898x677+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Profiles:
Profile-icc: 672 bytes
Properties:
date:create: 2023-01-23T21:48:17+00:00
date:modify: 2023-01-23T21:48:17+00:00
date:timestamp: 2023-01-23T22:41:00+00:00
icc:copyright: Public Domain
icc:description: GIMP built-in sRGB
icc:manufacturer: GIMP
icc:model: sRGB
png:bKGD: chunk was found (see Background color, above)
png:cHRM: chunk was found (see Chromaticity, above)
png:iCCP: chunk was found
png:IHDR.bit-depth-orig: 8
png:IHDR.bit_depth: 8
png:IHDR.color-type-orig: 6
png:IHDR.color_type: 6 (RGBA)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 898, 677
png:text: 8 tEXt/zTXt/iTXt chunks were found
png:text-encoded profiles: 1 were found
signature: 4c66ed2e90b6170ec6aa73f893b89d8007d0df621c15f78aab89891fe086a942
Artifacts:
verbose: true
Tainted: False
Filesize: 885759B
Number pixels: 607946
Pixel cache type: Memory
Pixels per second: 46.257MP
User time: 0.020u
Elapsed time: 0:01.013
Version: ImageMagick 7.1.0-58 Q16-HDRI x86_64 20802 https://imagemagick.org
Image:
Filename: insane.png
Permissions: rwxr-xr-x
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: DirectClass
Geometry: 753x770+0+0
Resolution: 28.34x28.34
Print size: 26.5702x27.1701
Units: PixelsPerCentimeter
Colorspace: sRGB
Type: TrueColorAlpha
Endianness: Undefined
Depth: 8-bit
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 8-bit
Alpha: 8-bit
Channel statistics:
Pixels: 579810
Red:
min: 0 (0)
max: 255 (1)
mean: 73.6133 (0.28868)
median: 0 (0)
standard deviation: 100.617 (0.394577)
kurtosis: -0.917795
skewness: 0.925
entropy: 0.381909
Green:
min: 0 (0)
max: 255 (1)
mean: 66.3444 (0.260174)
median: 0 (0)
standard deviation: 91.5125 (0.358873)
kurtosis: -0.879259
skewness: 0.938695
entropy: 0.386062
Blue:
min: 0 (0)
max: 255 (1)
mean: 62.6174 (0.245558)
median: 0 (0)
standard deviation: 83.5006 (0.327453)
kurtosis: -0.967664
skewness: 0.854211
entropy: 0.380587
Alpha:
min: 0 (0)
max: 255 (1)
mean: 113.83 (0.446393)
median: 0 (0)
standard deviation: 126.362 (0.495537)
kurtosis: -1.94916
skewness: 0.21525
entropy: 0.152762
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 79.1013 (0.310201)
median: 0 (0)
standard deviation: 100.498 (0.39411)
kurtosis: -1.19736
skewness: 0.773146
entropy: 0.32533
Alpha: none #00000000
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Matte color: grey74
Background color: white
Border color: srgb(223,223,223)
Transparent color: black
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 753x770+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2023-01-23T20:57:57+00:00
date:modify: 2023-01-23T20:57:57+00:00
date:timestamp: 2023-01-23T20:59:30+00:00
png:IHDR.bit-depth-orig: 8
png:IHDR.bit_depth: 8
png:IHDR.color-type-orig: 6
png:IHDR.color_type: 6 (RGBA)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 753, 770
png:pHYs: x_res=2834, y_res=2834, units=1
signature: d2aab82c02f789a4830019216e2ec4946d2535fc211fc003b7737831221c6de2
Artifacts:
verbose: true
Tainted: False
Filesize: 204968B
Number pixels: 579810
Pixel cache type: Memory
Pixels per second: 62.2394MP
User time: 0.020u
Elapsed time: 0:01.009
Version: ImageMagick 7.1.0-58 Q16-HDRI x86_64 20802 https://imagemagick.org
[blink#MythOS TEST]$ identify -verbose insane.png
Image:
Filename: insane.png
Permissions: rw-r--r--
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: DirectClass
Geometry: 753x770+0+0
Resolution: 28.34x28.34
Print size: 26.5702x27.1701
Units: PixelsPerCentimeter
Colorspace: sRGB
Type: TrueColorAlpha
Endianness: Undefined
Depth: 8-bit
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 8-bit
Alpha: 8-bit
Channel statistics:
Pixels: 579810
Red:
min: 0 (0)
max: 255 (1)
mean: 73.6133 (0.28868)
median: 0 (0)
standard deviation: 100.617 (0.394577)
kurtosis: -0.917795
skewness: 0.925
entropy: 0.381909
Green:
min: 0 (0)
max: 255 (1)
mean: 66.3444 (0.260174)
median: 0 (0)
standard deviation: 91.5125 (0.358873)
kurtosis: -0.879259
skewness: 0.938695
entropy: 0.386062
Blue:
min: 0 (0)
max: 255 (1)
mean: 62.6174 (0.245558)
median: 0 (0)
standard deviation: 83.5006 (0.327453)
kurtosis: -0.967664
skewness: 0.854211
entropy: 0.380587
Alpha:
min: 0 (0)
max: 255 (1)
mean: 113.83 (0.446393)
median: 0 (0)
standard deviation: 126.362 (0.495537)
kurtosis: -1.94916
skewness: 0.21525
entropy: 0.152762
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 79.1013 (0.310201)
median: 0 (0)
standard deviation: 100.498 (0.39411)
kurtosis: -1.19736
skewness: 0.773146
entropy: 0.32533
Alpha: none #00000000
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Matte color: grey74
Background color: white
Border color: srgb(223,223,223)
Transparent color: black
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 753x770+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2023-01-23T21:48:17+00:00
date:modify: 2023-01-23T21:48:17+00:00
date:timestamp: 2023-01-23T21:48:27+00:00
png:bKGD: chunk was found (see Background color, above)
png:cHRM: chunk was found (see Chromaticity, above)
png:IHDR.bit-depth-orig: 8
png:IHDR.bit_depth: 8
png:IHDR.color-type-orig: 6
png:IHDR.color_type: 6 (RGBA)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 753, 770
png:pHYs: x_res=2834, y_res=2834, units=1
png:text: 3 tEXt/zTXt/iTXt chunks were found
signature: d2aab82c02f789a4830019216e2ec4946d2535fc211fc003b7737831221c6de2
Artifacts:
verbose: true
Tainted: False
Filesize: 204437B
Number pixels: 579810
Pixel cache type: Memory
Pixels per second: 62.4627MP
User time: 0.020u
Elapsed time: 0:01.009
Version: ImageMagick 7.1.0-58 Q16-HDRI x86_64 20802 https://imagemagick.org
Image:
Filename: smooth_brain.png
Permissions: rwxr-xr-x
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: DirectClass
Geometry: 557x556+0+0
Resolution: 37.79x37.79
Print size: 14.7393x14.7129
Units: PixelsPerCentimeter
Colorspace: sRGB
Type: TrueColorAlpha
Endianness: Undefined
Depth: 8-bit
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 8-bit
Alpha: 1-bit
Channel statistics:
Pixels: 309692
Red:
min: 0 (0)
max: 255 (1)
mean: 186.136 (0.729945)
median: 220 (0.862745)
standard deviation: 68.4489 (0.268427)
kurtosis: 2.4105
skewness: -1.97795
entropy: 0.68527
Green:
min: 0 (0)
max: 236 (0.92549)
mean: 176.377 (0.691674)
median: 209 (0.819608)
standard deviation: 71.0393 (0.278586)
kurtosis: 1.32263
skewness: -1.63417
entropy: 0.688323
Blue:
min: 0 (0)
max: 255 (1)
mean: 181.988 (0.713678)
median: 211 (0.827451)
standard deviation: 65.9658 (0.258689)
kurtosis: 2.31119
skewness: -1.87115
entropy: 0.696014
Alpha:
min: 255 (1)
max: 255 (1)
mean: 255 (1)
median: 255 (1)
standard deviation: 0 (0)
kurtosis: 1.6384e+52
skewness: 9.375e+35
entropy: 0
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 199.875 (0.783824)
median: 223.75 (0.877451)
standard deviation: 51.3635 (0.201425)
kurtosis: 3.02315
skewness: -1.95237
entropy: 0.517402
Rendering intent: Perceptual
Gamma: 0.45455
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Matte color: grey74
Background color: white
Border color: srgb(223,223,223)
Transparent color: black
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 557x556+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2023-01-23T20:57:57+00:00
date:modify: 2023-01-23T20:57:57+00:00
date:timestamp: 2023-01-23T20:58:24+00:00
png:cHRM: chunk was found (see Chromaticity, above)
png:gAMA: gamma=0.45455 (See Gamma, above)
png:IHDR.bit-depth-orig: 8
png:IHDR.bit_depth: 8
png:IHDR.color-type-orig: 6
png:IHDR.color_type: 6 (RGBA)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 557, 556
png:pHYs: x_res=3779, y_res=3779, units=1
png:sRGB: intent=0 (Perceptual Intent)
signature: c5a4758ce0030fa4dcba3c8de843cb8a89157563cd4bc305d7c887301e813ddf
Artifacts:
verbose: true
Tainted: False
Filesize: 225641B
Number pixels: 309692
Pixel cache type: Memory
Pixels per second: 65.1504MP
User time: 0.000u
Elapsed time: 0:01.004
Version: ImageMagick 7.1.0-58 Q16-HDRI x86_64 20802 https://imagemagick.org
The convolutional kernel in prototxt file needs only setting height and weight of image and the third dimension can be automatically set.
But how do I set 4-D kernel in prototxt file ?
In the figure
the input video is 4-D.
The the work
says the dimension of first convoltional layer is 4-D.
I have stuck in the issue for two weeks and I'm kind of desperate.
Can anyone help me ?
Thank you
Caffe supports blobs with more than 4 dimensions. If you want to perform temporal convolutions, I suppose you'll need to feed caffe with 5D input blobs with dimensions batch-channels-time-height-width. With this kind of input you can have temporal convolutions simply by changing the default axis argument in the convolution_param. For example:
input: "data"
input_shape: { dim: 5 dim: 15 dim: 3 dim: 227 dim: 227 }
layer {
name: "temporal_conv"
type: "Convolution"
bottom: "data"
top: "temporal_conv"
param { lr_mult: 1 decay_mult: 1 }
param { lr_mult: 2 decay_mult: 0 }
convolution_param {
num_output: 32
kernel_size: 3 kernel_size: 5 kernel_size: 5
pad: 1 pad: 2 pad: 2
stride: 1 stride: 2 stride: 2
axis: 1
}
}
This "temporal_conv" layer uses 3x5x5 kernel (pads the input accordingly) and stride 2 in the spatial domain and 1 in the temporal dimension.
#Shai Thank you for replying! I use HDF5 fromat in data layer for training. Tha data store as five dimensions with the order batch-channels-time-height-width. The prototxt part is
layer {
name: "data"
type: "HDF5Data"
top: "data"
top: "label"
include: {
phase: TRAIN
}
hdf5_data_param {
source: "path/to/txt"
batch_size: 50
}
}
and I got the error
I0520 21:39:35.705278 30447 net.cpp:84] Creating Layer conv1
I0520 21:39:35.705286 30447 net.cpp:381] conv1 <- data
I0520 21:39:35.705294 30447 net.cpp:339] conv1 -> conv1
I0520 21:39:35.705307 30447 net.cpp:113] Setting up conv1
F0520 21:39:35.705329 30447 base_conv_layer.cpp:14] Check failed: 4 == bottom[0]->num_axes() (4 vs. 5) Input must have 4 axes, corresponding to (num, channels, height, width)
It seems the input blob dimension should be 4. Is there any solution?
I'm trying to format nicely this Combo Chart, so that the vertical axes on both sides share the same gridlines. However, the second Y-axis (right side) isn't formatted as viewWindowMode: 'pretty' automatically. The result is that the values start from 0 instead of 10,000.
By setting the min and max values:
viewWindowMode: 'explicit',
viewWindow: {
max: 14000,
min: 10000}
the outcome is nice, but the line touches top and bottom of the chart. So I tried giving it some padding by setting max: 15000and min: 9000, but then the number of gridlines increases and gridlines: {count: 6}doesn't seem to have an effect.
Is there a way to force viewWindowMode: 'pretty' on the second vertical axis?
The 'pretty' mode for an axis is going to result in unpredictable values, depending on where your data falls within the gridlines. So if you wish to coordinate the gridlines for both the left and right axes, you need to be more explicit about the viewWindow min and max for both, and the number of gridlines, or explicit ticks. You could do it like this: http://jsfiddle.net/dlaliberte/pyAz5/316/ Which uses these options:
var options = {
series: {
1: { targetAxisIndex: 1 }
},
vAxes: {
0: {
viewWindow: { min: 0, max: 1500 }
},
1: {
viewWindow: { min: 0, max: 1500 }
}
}
};
The gridlines.count option is not a guarantee in all cases because it could conflict with the heuristics for nice tick values.
I have a tif image that has transparent pixels (I can see them in paint.net as transparent pixels).
I am trying to read them into a Mat in openCV and I am using this code:
Mat image=imread(imagePathname,CV_LOAD_IMAGE_UNCHANGED);
auto x=image.channels();
based on I my understanding, since the input image has transparency, channels() should return 4, but it return 3.
How can I read a tif image with transparent pixels and checking if a pixel is transparent in opencv?
edit1
Result of running imagemagick:
Image: layer0003.tif
Format: TIFF (Tagged Image File Format)
Mime type: image/tiff
Class: DirectClass
Geometry: 10000x5000+0+0
Resolution: 150x150
Print size: 66.6667x33.3333
Units: PixelsPerInch
Type: TrueColorAlpha
Base type: TrueColor
Endianess: MSB
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
alpha: 1-bit
Channel statistics:
Red:
min: 0 (0)
max: 255 (1)
mean: 23.6472 (0.0927342)
standard deviation: 37.6851 (0.147785)
kurtosis: 8.93054
skewness: 2.28009
Green:
min: 0 (0)
max: 255 (1)
mean: 22.8353 (0.0895504)
standard deviation: 37.6516 (0.147653)
kurtosis: 10.4255
skewness: 2.52881
Blue:
min: 0 (0)
max: 255 (1)
mean: 22.798 (0.0894041)
standard deviation: 37.6575 (0.147677)
kurtosis: 10.9059
skewness: 2.58999
Alpha:
min: 0 (0)
max: 255 (1)
mean: 89.055 (0.349235)
standard deviation: 121.566 (0.476728)
kurtosis: -1.59995
skewness: -0.632496
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 58.8064 (0.230613)
standard deviation: 68.9821 (0.270518)
kurtosis: 8.35337
skewness: 3.53852
Alpha: none #00000000
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Background color: white
Border color: srgba(223,223,223,1)
Matte color: grey74
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 10000x5000+0+0
Dispose: Undefined
Iterations: 0
Compression: LZW
Orientation: TopLeft
Properties:
date:create: 2014-03-01T13:11:12+00:00
date:modify: 2014-02-28T17:48:41+00:00
signature: dfa3e35c35345ef3440ff15d15ad37222f9cf0376bed7b7710dd95f4e537e210
tiff:alpha: unassociated
tiff:endian: lsb
tiff:photometric: RGB
tiff:rows-per-strip: 1
tiff:timestamp: 2014:02:28 17:48:38
xmp:CreatorTool: Microsoft Windows Live Photo Gallery 15.4.3555.308
Profiles:
Profile-xmp: 12702 bytes
Artifacts:
filename: layer0003.tif
verbose: true
Tainted: False
Filesize: 20.42MB
Number pixels: 50M
Pixels per second: 60.24MB
User time: 0.827u
Elapsed time: 0:01.829
Version: ImageMagick 6.8.8-7 Q16 x64 2014-02-13 http://www.imagemagick.org
I just had some time to revisit this :-)
Basically, I think the issue is that ImageMagick will adopt the most economical, in terms of file size, when writing its output files. So, if your image is basically greyscale but the alpha (opacity) channel is only 0 or 1, ImageMagick will encode that with 16-bit greyscale for the data and single-bit alpha channel. I guess that is beyond OpenCV as it seems to expect the alpha to be encoded with the same depth as the data.
So, the question becomes... "How can you force the combination you need of data/alpha (both 8-bit, not 8-bit plus 1-bit) greyscale/colour (8-bit greyscale or 8-bit colour)?"
There may be other ways, but for now, I can envisage adding a row across the bottom of the image that forces ImageMagick's hand and which you can hopefully readily remove once it has done the trick for you in OpenCV.
So, let's create a 16-bit greyscale image with a single-bit alpha where it makes the square transparent hole in the middle:
convert -size 300x300 gradient:black-white -alpha set -region 100x100+100+100 -alpha transparent image.tif
Let's check what we have:
identify -verbose image.tif | head -14
Image: image.tif
Format: TIFF (Tagged Image File Format)
Mime type: image/tiff
Class: DirectClass
Geometry: 300x300+0+0
Units: PixelsPerInch
Type: GrayscaleAlpha
Base type: Grayscale
Endianess: LSB
Colorspace: Gray
Depth: 16-bit
Channel depth:
gray: 16-bit <--- 16-bit greyscale data
alpha: 1-bit <--- 1-bit alpha
Now let's force it to 8-bit alpha and 8-bit data:
# Force to at least 8-bit greyscale (but maybe RGB depending on rest of image) plus 8-bit alpha...
# ... by adding a line across the bottom with alpha varying from 0 to 1 (i=x coordinate,w=width)
convert image.tif \
\( +clone -resize x1! -channel A -fx "i/w" \) \
-append -depth 8 result.tif
Let's check it worked:
identify -verbose result.tif | head -16
Image: result.tif
Format: TIFF (Tagged Image File Format)
Mime type: image/tiff
Class: DirectClass
Geometry: 300x301+0+0 <--- one extra row
Units: PixelsPerInch
Type: GrayscaleAlpha
Base type: Grayscale
Endianess: LSB
Colorspace: Gray
Depth: 8-bit
Channel depth:
gray: 8-bit <--- 8-bit data
alpha: 8-bit <--- 8-bit alpha
Now let's force 8-bit RGB plus 8-bit alpha:
# Force to 8-bit RGB plus 8-bit alpha...
# ... by adding a coloured line across the bottom with alpha varying from 0 to 1 (i=x coordinate,w=width)
convert image.tif \
\( +clone -resize x1! -channel RGBA -fx "rand()" \) \
-append -depth 8 result.tif
And let's check again:
Image: result.tif
Format: TIFF (Tagged Image File Format)
Mime type: image/tiff
Class: DirectClass
Geometry: 300x301+0+0 <--- 1 extra row
Units: PixelsPerInch
Type: TrueColorAlpha
Base type: TrueColor <--- Truecolour
Endianess: LSB
Colorspace: sRGB <--- RGB
Depth: 8-bit
Channel depth:
red: 8-bit <--- 8-bit red
green: 8-bit <--- 8-bit green
blue: 8-bit <--- 8-bit blue
alpha: 8-bit <--- 8-bit alpha
Now I am creating my own classifier for face detection.now I want to train the classifier.So when I give the command 'opencv_haartraining -data facehaar -vec vecfile.vec -bg negatives.txt -npos 3 -nneg 5 -nstages 30 -w 30 -h 32' it shows like this.What is this error?I don't understand?Could any one help me?
Data dir name: facehaar
Vec file name: vecfile.vec
BG file name: negatives.txt, is a vecfile: no
Num pos: 3
Num neg: 5
Num stages: 30
Num splits: 1 (stump as weak classifier)
Mem: 200 MB
Symmetric: TRUE
Min hit rate: 0.995000
Max false alarm rate: 0.500000
Weight trimming: 0.950000
Equal weights: FALSE
Mode: BASIC
Width: 30
Height: 32
Applied boosting algorithm: GAB
Error (valid only for Discrete and Real AdaBoost): misclass
Max number of splits in tree cascade: 0
Min number of positive samples per cluster: 500
Required leaf false alarm rate: 9.31323e-10
Tree Classifier
Stage
+---+
| 0|
+---+
Number of features used : 234720
Parent node: NULL
*** 1 cluster ***
POS: 3 3 1.000000
Invalid background description file.