1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Warning fixes continued

This commit is contained in:
Andrey Kamaev
2012-06-09 15:00:04 +00:00
parent f6b451c607
commit f2d3b9b4a1
127 changed files with 6298 additions and 6277 deletions
+1 -1
View File
@@ -134,7 +134,7 @@ endif()
if(HAVE_OPENNI)
list(APPEND highgui_srcs src/cap_openni.cpp)
include_directories(AFTER SYSTEM ${OPENNI_INCLUDE_DIR})
ocv_include_directories(${OPENNI_INCLUDE_DIR})
list(APPEND HIGHGUI_LIBRARIES ${OPENNI_LIBRARY})
endif(HAVE_OPENNI)
+10 -14
View File
@@ -283,7 +283,7 @@ void CvCapture_GStreamer::newPad(GstElement *uridecodebin,
sinkpad = gst_element_get_static_pad (color, "sink");
// printf("linking dynamic pad to colourconverter %p %p\n", uridecodebin, pad);
gst_pad_link (pad, sinkpad);
@@ -357,13 +357,13 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
if(manualpipeline) {
GstIterator *it = gst_bin_iterate_sinks(GST_BIN(uridecodebin));
if(gst_iterator_next(it, (gpointer *)&sink) != GST_ITERATOR_OK) {
CV_ERROR(CV_StsError, "GStreamer: cannot find appsink in manual pipeline\n");
return false;
CV_ERROR(CV_StsError, "GStreamer: cannot find appsink in manual pipeline\n");
return false;
}
pipeline = uridecodebin;
pipeline = uridecodebin;
} else {
pipeline = gst_pipeline_new (NULL);
pipeline = gst_pipeline_new (NULL);
color = gst_element_factory_make("ffmpegcolorspace", NULL);
sink = gst_element_factory_make("appsink", NULL);
@@ -381,16 +381,12 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
gst_app_sink_set_max_buffers (GST_APP_SINK(sink), 1);
gst_app_sink_set_drop (GST_APP_SINK(sink), stream);
{
GstCaps* caps;
caps = gst_caps_new_simple("video/x-raw-rgb",
"red_mask", G_TYPE_INT, 0x0000FF,
"green_mask", G_TYPE_INT, 0x00FF00,
"blue_mask", G_TYPE_INT, 0xFF0000,
NULL);
gst_app_sink_set_caps(GST_APP_SINK(sink), caps);
gst_app_sink_set_caps(GST_APP_SINK(sink), gst_caps_new_simple("video/x-raw-rgb",
"red_mask", G_TYPE_INT, 0x0000FF,
"green_mask", G_TYPE_INT, 0x00FF00,
"blue_mask", G_TYPE_INT, 0xFF0000,
NULL));
gst_caps_unref(caps);
}
if(gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_READY) ==
GST_STATE_CHANGE_FAILURE) {
+19 -19
View File
@@ -779,9 +779,9 @@ static int _capture_V4L2 (CvCaptureCAM_V4L *capture, char *deviceName)
return -1;
} else {
buffer_number--;
fprintf (stderr, "Insufficient buffer memory on %s -- decreaseing buffers\n", deviceName);
fprintf (stderr, "Insufficient buffer memory on %s -- decreaseing buffers\n", deviceName);
goto try_again;
goto try_again;
}
}
@@ -824,8 +824,8 @@ static int _capture_V4L2 (CvCaptureCAM_V4L *capture, char *deviceName)
if (capture->buffers[MAX_V4L_BUFFERS].start) {
free(capture->buffers[MAX_V4L_BUFFERS].start);
capture->buffers[MAX_V4L_BUFFERS].start = NULL;
}
}
capture->buffers[MAX_V4L_BUFFERS].start = malloc(buf.length);
capture->buffers[MAX_V4L_BUFFERS].length = buf.length;
};
@@ -1080,11 +1080,11 @@ static int read_frame_v4l2(CvCaptureCAM_V4L* capture) {
#ifdef USE_TEMP_BUFFER
memcpy(capture->buffers[MAX_V4L_BUFFERS].start,
capture->buffers[buf.index].start,
capture->buffers[MAX_V4L_BUFFERS].length );
capture->buffers[buf.index].start,
capture->buffers[MAX_V4L_BUFFERS].length );
capture->bufferIndex = MAX_V4L_BUFFERS;
//printf("got data in buff %d, len=%d, flags=0x%X, seq=%d, used=%d)\n",
// buf.index, buf.length, buf.flags, buf.sequence, buf.bytesused);
// buf.index, buf.length, buf.flags, buf.sequence, buf.bytesused);
#else
capture->bufferIndex = buf.index;
#endif
@@ -1211,9 +1211,9 @@ static int icvGrabFrameCAM_V4L(CvCaptureCAM_V4L* capture) {
capture->mmaps[capture->bufferIndex].format = capture->imageProperties.palette;
if (v4l1_ioctl (capture->deviceHandle, VIDIOCMCAPTURE,
&capture->mmaps[capture->bufferIndex]) == -1) {
/* capture is on the way, so just exit */
return 1;
&capture->mmaps[capture->bufferIndex]) == -1) {
/* capture is on the way, so just exit */
return 1;
}
++capture->bufferIndex;
@@ -1273,11 +1273,11 @@ static IplImage* icvRetrieveFrameCAM_V4L( CvCaptureCAM_V4L* capture, int) {
if (capture->is_v4l2_device == 1)
{
if(capture->buffers[capture->bufferIndex].start){
memcpy((char *)capture->frame.imageData,
(char *)capture->buffers[capture->bufferIndex].start,
capture->frame.imageSize);
}
if(capture->buffers[capture->bufferIndex].start){
memcpy((char *)capture->frame.imageData,
(char *)capture->buffers[capture->bufferIndex].start,
capture->frame.imageSize);
}
} else
#endif /* HAVE_CAMV4L2 */
@@ -1353,7 +1353,7 @@ static double icvGetPropertyCAM_V4L (CvCaptureCAM_V4L* capture,
sprintf(name, "<unknown property string>");
capture->control.id = property_id;
}
if(v4l2_ioctl(capture->deviceHandle, VIDIOC_G_CTRL, &capture->control) == 0) {
/* all went well */
is_v4l2_device = 1;
@@ -1519,7 +1519,7 @@ static int icvSetControl (CvCaptureCAM_V4L* capture, int property_id, double val
CLEAR (capture->control);
CLEAR (capture->queryctrl);
/* get current values */
switch (property_id) {
case CV_CAP_PROP_BRIGHTNESS:
@@ -1688,8 +1688,8 @@ static void icvCloseCAM_V4L( CvCaptureCAM_V4L* capture ){
if (xioctl(capture->deviceHandle, VIDIOC_STREAMOFF, &capture->type) < 0) {
perror ("Unable to stop the stream.");
}
for (unsigned int n_buffers = 0; n_buffers < capture->req.count; ++n_buffers) {
if (-1 == v4l2_munmap (capture->buffers[n_buffers].start, capture->buffers[n_buffers].length)) {
for (unsigned int n_buffers2 = 0; n_buffers2 < capture->req.count; ++n_buffers2) {
if (-1 == v4l2_munmap (capture->buffers[n_buffers2].start, capture->buffers[n_buffers2].length)) {
perror ("munmap");
}
}
+8 -8
View File
@@ -157,22 +157,22 @@ bool PngDecoder::readHeader()
if( !m_buf.empty() || m_f )
{
png_uint_32 width, height;
png_uint_32 wdth, hght;
int bit_depth, color_type;
png_read_info( png_ptr, info_ptr );
png_get_IHDR( png_ptr, info_ptr, &width, &height,
png_get_IHDR( png_ptr, info_ptr, &wdth, &hght,
&bit_depth, &color_type, 0, 0, 0 );
m_width = (int)width;
m_height = (int)height;
m_width = (int)wdth;
m_height = (int)hght;
m_color_type = color_type;
m_bit_depth = bit_depth;
if( bit_depth <= 8 || bit_depth == 16 )
{
switch(color_type)
switch(color_type)
{
case PNG_COLOR_TYPE_RGB:
case PNG_COLOR_TYPE_PALETTE:
@@ -224,7 +224,7 @@ bool PngDecoder::readData( Mat& img )
else if( !isBigEndian() )
png_set_swap( png_ptr );
if(img.channels() < 4)
if(img.channels() < 4)
{
/* observation: png_read_image() writes 400 bytes beyond
* end of data when reading a 400x118 color png
@@ -247,7 +247,7 @@ bool PngDecoder::readData( Mat& img )
#else
png_set_gray_1_2_4_to_8( png_ptr );
#endif
if( CV_MAT_CN(m_type) > 1 && color )
png_set_bgr( png_ptr ); // convert RGB to BGR
else if( color )
@@ -330,7 +330,7 @@ bool PngEncoder::write( const Mat& img, const vector<int>& params )
if( params[i] == CV_IMWRITE_PNG_STRATEGY )
{
compression_strategy = params[i+1];
compression_strategy = MIN(MAX(compression_strategy, 0), Z_FIXED);
compression_strategy = MIN(MAX(compression_strategy, 0), Z_FIXED);
}
}
+12 -12
View File
@@ -115,19 +115,19 @@ bool TiffDecoder::readHeader()
if( tif )
{
int width = 0, height = 0, photometric = 0;
int wdth = 0, hght = 0, photometric = 0;
m_tif = tif;
if( TIFFGetField( tif, TIFFTAG_IMAGEWIDTH, &width ) &&
TIFFGetField( tif, TIFFTAG_IMAGELENGTH, &height ) &&
if( TIFFGetField( tif, TIFFTAG_IMAGEWIDTH, &wdth ) &&
TIFFGetField( tif, TIFFTAG_IMAGELENGTH, &hght ) &&
TIFFGetField( tif, TIFFTAG_PHOTOMETRIC, &photometric ))
{
int bpp=8, ncn = photometric > 1 ? 3 : 1;
TIFFGetField( tif, TIFFTAG_BITSPERSAMPLE, &bpp );
TIFFGetField( tif, TIFFTAG_SAMPLESPERPIXEL, &ncn );
m_width = width;
m_height = height;
m_width = wdth;
m_height = hght;
if( bpp > 8 &&
((photometric != 2 && photometric != 1) ||
(ncn != 1 && ncn != 3 && ncn != 4)))
@@ -169,7 +169,7 @@ bool TiffDecoder::readData( Mat& img )
bool color = img.channels() > 1;
uchar* data = img.data;
int step = (int)img.step;
if( img.depth() != CV_8U && img.depth() != CV_16U && img.depth() != CV_32F && img.depth() != CV_64F )
return false;
@@ -422,9 +422,9 @@ bool TiffEncoder::writeLibTiff( const Mat& img, const vector<int>& /*params*/)
default:
{
return false;
}
}
}
const int bitsPerByte = 8;
size_t fileStep = (width * channels * bitsPerChannel) / bitsPerByte;
int rowsPerStrip = (int)((1 << 13)/fileStep);
@@ -443,7 +443,7 @@ bool TiffEncoder::writeLibTiff( const Mat& img, const vector<int>& /*params*/)
{
return false;
}
// defaults for now, maybe base them on params in the future
int compression = COMPRESSION_LZW;
int predictor = PREDICTOR_HORIZONTAL;
@@ -516,7 +516,7 @@ bool TiffEncoder::writeLibTiff( const Mat& img, const vector<int>& /*params*/)
return false;
}
}
TIFFClose(pTiffHandle);
return true;
}
@@ -546,7 +546,7 @@ bool TiffEncoder::write( const Mat& img, const vector<int>& /*params*/)
if( !strm.open(*m_buf) )
return false;
}
else
else
{
#ifdef HAVE_TIFF
return writeLibTiff(img, params);
+8 -8
View File
@@ -60,9 +60,9 @@ protected:
void CV_DrawingTest::run( int )
{
Mat testImg, valImg;
const string name = "drawing/image.jpg";
const string fname = "drawing/image.jpg";
string path = ts->get_data_path(), filename;
filename = path + name;
filename = path + fname;
draw( testImg );
@@ -415,30 +415,30 @@ class CV_FillConvexPolyTest : public cvtest::BaseTest
{
public:
CV_FillConvexPolyTest() {}
~CV_FillConvexPolyTest() {}
~CV_FillConvexPolyTest() {}
protected:
void run(int)
{
vector<Point> line1;
vector<Point> line2;
line1.push_back(Point(1, 1));
line1.push_back(Point(5, 1));
line1.push_back(Point(5, 8));
line1.push_back(Point(1, 8));
line2.push_back(Point(2, 2));
line2.push_back(Point(10, 2));
line2.push_back(Point(10, 16));
line2.push_back(Point(2, 16));
Mat gray0(10,10,CV_8U, Scalar(0));
fillConvexPoly(gray0, line1, Scalar(255), 8, 0);
int nz1 = countNonZero(gray0);
fillConvexPoly(gray0, line2, Scalar(0), 8, 1);
int nz2 = countNonZero(gray0)/255;
CV_Assert( nz1 == 40 && nz2 == 0 );
}
};
+8 -8
View File
@@ -53,7 +53,7 @@ string fourccToString(int fourcc)
{
return format("%c%c%c%c", fourcc & 255, (fourcc >> 8) & 255, (fourcc >> 16) & 255, (fourcc >> 24) & 255);
}
const VideoFormat g_specific_fmt_list[] =
{
VideoFormat("avi", CV_FOURCC('X', 'V', 'I', 'D')),
@@ -63,11 +63,11 @@ const VideoFormat g_specific_fmt_list[] =
VideoFormat("mkv", CV_FOURCC('X', 'V', 'I', 'D')),
VideoFormat("mkv", CV_FOURCC('M', 'P', 'E', 'G')),
VideoFormat("mkv", CV_FOURCC('M', 'J', 'P', 'G')),
VideoFormat("mov", CV_FOURCC('m', 'p', '4', 'v')),
VideoFormat()
};
}
class CV_HighGuiTest : public cvtest::BaseTest
@@ -246,7 +246,7 @@ void CV_HighGuiTest::VideoTest(const string& dir, const cvtest::VideoFormat& fmt
if (!img)
break;
frames.push_back(Mat(img).clone());
if (writer == 0)
@@ -393,7 +393,7 @@ void CV_HighGuiTest::SpecificVideoTest(const string& dir, const cvtest::VideoFor
{
string ext = fmt.ext;
int fourcc = fmt.fourcc;
string fourcc_str = cvtest::fourccToString(fourcc);
const string video_file = "video_" + fourcc_str + "." + ext;
@@ -403,7 +403,7 @@ void CV_HighGuiTest::SpecificVideoTest(const string& dir, const cvtest::VideoFor
if (!writer.isOpened())
{
// call it repeatedly for easier debugging
VideoWriter writer(video_file, fourcc, 25, frame_size, true);
VideoWriter writer2(video_file, fourcc, 25, frame_size, true);
ts->printf(ts->LOG, "Creating a video in %s...\n", video_file.c_str());
ts->printf(ts->LOG, "Cannot create VideoWriter object with codec %s.\n", fourcc_str.c_str());
ts->set_failed_test_info(ts->FAIL_MISMATCH);
@@ -412,7 +412,7 @@ void CV_HighGuiTest::SpecificVideoTest(const string& dir, const cvtest::VideoFor
const size_t IMAGE_COUNT = 30;
vector<Mat> images;
for( size_t i = 0; i < IMAGE_COUNT; ++i )
{
string file_path = format("%s../python/images/QCIF_%02d.bmp", dir.c_str(), i);
@@ -432,7 +432,7 @@ void CV_HighGuiTest::SpecificVideoTest(const string& dir, const cvtest::VideoFor
if (img.at<Vec3b>(k, l) == Vec3b::all(0))
img.at<Vec3b>(k, l) = Vec3b(0, 255, 0);
else img.at<Vec3b>(k, l) = Vec3b(0, 0, 255);
resize(img, img, frame_size, 0.0, 0.0, INTER_CUBIC);
images.push_back(img);