mirror of
https://github.com/opencv/opencv.git
synced 2026-07-25 21:33:04 +04:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0354d01e79 | |||
| 45d3aac730 | |||
| 318ac6b8c9 | |||
| 7d332100a4 | |||
| 56072c4406 | |||
| cd64b504b8 | |||
| 443059e371 | |||
| 8f9c4d23e0 | |||
| 8b90db3f25 | |||
| ec16307632 | |||
| fdefc4b09d | |||
| 61d8292652 | |||
| 43f1b72e92 | |||
| 1f4b8c2785 |
@@ -61,7 +61,9 @@ if(NOT DEFINED OpenCV_CUDA)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
if(DEFINED OpenCV_ARCH AND DEFINED OpenCV_RUNTIME)
|
||||
# custom overrided values
|
||||
elseif(MSVC)
|
||||
if(CMAKE_CL_64)
|
||||
set(OpenCV_ARCH x64)
|
||||
set(OpenCV_TBB_ARCH intel64)
|
||||
@@ -81,7 +83,7 @@ if(MSVC)
|
||||
set(OpenCV_RUNTIME vc12)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
set(OpenCV_RUNTIME vc14)
|
||||
elseif(MSVC_VERSION EQUAL 1910 OR MSVC_VERSION EQUAL 1911)
|
||||
elseif(MSVC_VERSION MATCHES "^191[0-9]$")
|
||||
set(OpenCV_RUNTIME vc15)
|
||||
endif()
|
||||
elseif(MINGW)
|
||||
|
||||
@@ -82,7 +82,9 @@ if(NOT DEFINED OpenCV_STATIC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
if(DEFINED OpenCV_ARCH AND DEFINED OpenCV_RUNTIME)
|
||||
# custom overrided values
|
||||
elseif(MSVC)
|
||||
if(CMAKE_CL_64)
|
||||
set(OpenCV_ARCH x64)
|
||||
else()
|
||||
@@ -100,7 +102,7 @@ if(MSVC)
|
||||
set(OpenCV_RUNTIME vc12)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
set(OpenCV_RUNTIME vc14)
|
||||
elseif(MSVC_VERSION EQUAL 1910 OR MSVC_VERSION EQUAL 1911)
|
||||
elseif(MSVC_VERSION MATCHES "^191[0-9]$")
|
||||
set(OpenCV_RUNTIME vc15)
|
||||
endif()
|
||||
elseif(MINGW)
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#define CV_VERSION_EPOCH 2
|
||||
#define CV_VERSION_MAJOR 4
|
||||
#define CV_VERSION_MINOR 13
|
||||
#define CV_VERSION_REVISION 5
|
||||
#define CV_VERSION_REVISION 6
|
||||
|
||||
#define CVAUX_STR_EXP(__A) #__A
|
||||
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
|
||||
|
||||
@@ -2994,6 +2994,7 @@ PCA& PCA::computeVar(InputArray _data, InputArray __mean, int flags, double reta
|
||||
{
|
||||
CV_Assert( _mean.size() == mean_sz );
|
||||
_mean.convertTo(mean, ctype);
|
||||
covar_flags |= CV_COVAR_USE_AVG;
|
||||
}
|
||||
|
||||
calcCovarMatrix( data, covar, mean, covar_flags, ctype );
|
||||
|
||||
@@ -272,9 +272,8 @@ void SimpleBlobDetector::findBlobs(const cv::Mat &image, const cv::Mat &binaryIm
|
||||
#endif
|
||||
}
|
||||
|
||||
void SimpleBlobDetector::detectImpl(const cv::Mat& image, std::vector<cv::KeyPoint>& keypoints, const cv::Mat&) const
|
||||
void SimpleBlobDetector::detectImpl(const cv::Mat& image, std::vector<cv::KeyPoint>& keypoints, const cv::Mat& mask) const
|
||||
{
|
||||
//TODO: support mask
|
||||
keypoints.clear();
|
||||
Mat grayscaleImage;
|
||||
if (image.channels() == 3)
|
||||
@@ -355,6 +354,11 @@ void SimpleBlobDetector::detectImpl(const cv::Mat& image, std::vector<cv::KeyPoi
|
||||
keypoints.push_back(kpt);
|
||||
}
|
||||
|
||||
if (!mask.empty())
|
||||
{
|
||||
KeyPointsFilter::runByPixelsMask(keypoints, mask);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_BLOB_DETECTOR
|
||||
namedWindow("keypoints", CV_WINDOW_NORMAL);
|
||||
Mat outImg = image.clone();
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "bitstrm.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
@@ -103,7 +104,6 @@ void RBaseStream::readBlock()
|
||||
fseek( m_file, m_block_pos, SEEK_SET );
|
||||
size_t readed = fread( m_start, 1, m_block_size, m_file );
|
||||
m_end = m_start + readed;
|
||||
m_current = m_start;
|
||||
|
||||
if( readed == 0 || m_current >= m_end )
|
||||
throw RBS_THROW_EOS;
|
||||
@@ -164,7 +164,7 @@ void RBaseStream::release()
|
||||
|
||||
void RBaseStream::setPos( int pos )
|
||||
{
|
||||
assert( isOpened() && pos >= 0 );
|
||||
CV_Assert(isOpened() && pos >= 0);
|
||||
|
||||
if( !m_file )
|
||||
{
|
||||
@@ -181,14 +181,19 @@ void RBaseStream::setPos( int pos )
|
||||
|
||||
int RBaseStream::getPos()
|
||||
{
|
||||
assert( isOpened() );
|
||||
return m_block_pos + (int)(m_current - m_start);
|
||||
CV_Assert(isOpened());
|
||||
int pos = validateToInt((m_current - m_start) + m_block_pos);
|
||||
CV_Assert(pos >= m_block_pos); // overflow check
|
||||
CV_Assert(pos >= 0); // overflow check
|
||||
return pos;
|
||||
}
|
||||
|
||||
void RBaseStream::skip( int bytes )
|
||||
{
|
||||
assert( bytes >= 0 );
|
||||
CV_Assert(bytes >= 0);
|
||||
uchar* old = m_current;
|
||||
m_current += bytes;
|
||||
CV_Assert(m_current >= old); // overflow check
|
||||
}
|
||||
|
||||
///////////////////////// RLByteStream ////////////////////////////
|
||||
@@ -220,7 +225,7 @@ int RLByteStream::getBytes( void* buffer, int count )
|
||||
{
|
||||
uchar* data = (uchar*)buffer;
|
||||
int readed = 0;
|
||||
assert( count >= 0 );
|
||||
CV_Assert(count >= 0);
|
||||
|
||||
while( count > 0 )
|
||||
{
|
||||
@@ -371,7 +376,7 @@ void WBaseStream::writeBlock()
|
||||
{
|
||||
int size = (int)(m_current - m_start);
|
||||
|
||||
assert( isOpened() );
|
||||
CV_Assert(isOpened());
|
||||
if( size == 0 )
|
||||
return;
|
||||
|
||||
@@ -442,7 +447,7 @@ void WBaseStream::release()
|
||||
|
||||
int WBaseStream::getPos()
|
||||
{
|
||||
assert( isOpened() );
|
||||
CV_Assert(isOpened());
|
||||
return m_block_pos + (int)(m_current - m_start);
|
||||
}
|
||||
|
||||
@@ -465,7 +470,7 @@ void WLByteStream::putBytes( const void* buffer, int count )
|
||||
{
|
||||
uchar* data = (uchar*)buffer;
|
||||
|
||||
assert( data && m_current && count >= 0 );
|
||||
CV_Assert(data && m_current && count >= 0);
|
||||
|
||||
while( count )
|
||||
{
|
||||
|
||||
@@ -92,6 +92,7 @@ bool BmpDecoder::readHeader()
|
||||
m_offset = m_strm.getDWord();
|
||||
|
||||
int size = m_strm.getDWord();
|
||||
CV_Assert(size > 0); // overflow, 2Gb limit
|
||||
|
||||
if( size >= 36 )
|
||||
{
|
||||
|
||||
@@ -77,7 +77,8 @@ static JasperInitializer initialize_jasper;
|
||||
|
||||
Jpeg2KDecoder::Jpeg2KDecoder()
|
||||
{
|
||||
m_signature = '\0' + string() + '\0' + string() + '\0' + string("\x0cjP \r\n\x87\n");
|
||||
static const unsigned char signature_[12] = { 0, 0, 0, 0x0c, 'j', 'P', ' ', ' ', 13, 10, 0x87, 10};
|
||||
m_signature = string((const char*)signature_, (const char*)signature_ + sizeof(signature_));
|
||||
m_stream = 0;
|
||||
m_image = 0;
|
||||
}
|
||||
@@ -121,6 +122,8 @@ bool Jpeg2KDecoder::readHeader()
|
||||
jas_image_t* image = jas_image_decode( stream, -1, 0 );
|
||||
m_image = image;
|
||||
if( image ) {
|
||||
CV_Assert(0 == (jas_image_tlx(image)) && "not supported");
|
||||
CV_Assert(0 == (jas_image_tly(image)) && "not supported");
|
||||
m_width = jas_image_width( image );
|
||||
m_height = jas_image_height( image );
|
||||
|
||||
@@ -130,14 +133,31 @@ bool Jpeg2KDecoder::readHeader()
|
||||
for( int i = 0; i < numcmpts; i++ )
|
||||
{
|
||||
int depth_i = jas_image_cmptprec( image, i );
|
||||
CV_Assert(depth == 0 || depth == depth_i); // component data type mismatch
|
||||
depth = MAX(depth, depth_i);
|
||||
if( jas_image_cmpttype( image, i ) > 2 )
|
||||
continue;
|
||||
int sgnd = jas_image_cmptsgnd(image, i);
|
||||
int xstart = jas_image_cmpttlx(image, i);
|
||||
int xend = jas_image_cmptbrx(image, i);
|
||||
int xstep = jas_image_cmpthstep(image, i);
|
||||
int ystart = jas_image_cmpttly(image, i);
|
||||
int yend = jas_image_cmptbry(image, i);
|
||||
int ystep = jas_image_cmptvstep(image, i);
|
||||
CV_Assert(sgnd == 0 && "not supported");
|
||||
CV_Assert(xstart == 0 && "not supported");
|
||||
CV_Assert(ystart == 0 && "not supported");
|
||||
CV_Assert(xstep == 1 && "not supported");
|
||||
CV_Assert(ystep == 1 && "not supported");
|
||||
CV_Assert(xend == m_width);
|
||||
CV_Assert(yend == m_height);
|
||||
cntcmpts++;
|
||||
}
|
||||
|
||||
if( cntcmpts )
|
||||
{
|
||||
CV_Assert(depth == 8 || depth == 16);
|
||||
CV_Assert(cntcmpts == 1 || cntcmpts == 3);
|
||||
m_type = CV_MAKETYPE(depth <= 8 ? CV_8U : CV_16U, cntcmpts > 1 ? 3 : 1);
|
||||
result = true;
|
||||
}
|
||||
@@ -150,9 +170,15 @@ bool Jpeg2KDecoder::readHeader()
|
||||
return result;
|
||||
}
|
||||
|
||||
static void Jpeg2KDecoder_close(Jpeg2KDecoder* ptr)
|
||||
{
|
||||
ptr->close();
|
||||
}
|
||||
template<> void Ptr<Jpeg2KDecoder>::delete_obj() { Jpeg2KDecoder_close(obj); }
|
||||
|
||||
bool Jpeg2KDecoder::readData( Mat& img )
|
||||
{
|
||||
Ptr<Jpeg2KDecoder> close_this(this); // auto cleanup: Jpeg2KDecoder_close
|
||||
bool result = false;
|
||||
int color = img.channels() > 1;
|
||||
uchar* data = img.data;
|
||||
@@ -204,11 +230,16 @@ bool Jpeg2KDecoder::readData( Mat& img )
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "JPEG 2000 LOADER ERROR: cannot convert colorspace\n");
|
||||
{
|
||||
jas_cmprof_destroy(clrprof);
|
||||
CV_Error(CV_StsError, "JPEG 2000 LOADER ERROR: cannot convert colorspace");
|
||||
}
|
||||
jas_cmprof_destroy( clrprof );
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "JPEG 2000 LOADER ERROR: unable to create colorspace\n");
|
||||
{
|
||||
CV_Error(CV_StsError, "JPEG 2000 LOADER ERROR: unable to create colorspace");
|
||||
}
|
||||
}
|
||||
else
|
||||
result = true;
|
||||
@@ -257,8 +288,8 @@ bool Jpeg2KDecoder::readData( Mat& img )
|
||||
result = readComponent16u( ((unsigned short *)data) + i, buffer, validateToInt(step / 2), cmptlut[i], maxval, offset, ncmpts );
|
||||
if( !result )
|
||||
{
|
||||
i = ncmpts;
|
||||
result = false;
|
||||
jas_matrix_destroy( buffer );
|
||||
CV_Error(CV_StsError, "JPEG2000 LOADER ERROR: failed to read component");
|
||||
}
|
||||
}
|
||||
jas_matrix_destroy( buffer );
|
||||
@@ -267,10 +298,12 @@ bool Jpeg2KDecoder::readData( Mat& img )
|
||||
}
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "JPEG2000 LOADER ERROR: colorspace conversion failed\n" );
|
||||
{
|
||||
CV_Error(CV_StsError, "JPEG2000 LOADER ERROR: colorspace conversion failed");
|
||||
}
|
||||
}
|
||||
|
||||
close();
|
||||
CV_Assert(result == true);
|
||||
|
||||
#ifndef WIN32
|
||||
if (!clr.empty())
|
||||
|
||||
@@ -331,7 +331,7 @@ bool PxMDecoder::readData( Mat& img )
|
||||
}
|
||||
}
|
||||
else
|
||||
memcpy( data, src, m_width*(bit_depth/8) );
|
||||
memcpy(data, src, img.elemSize1()*m_width);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -120,7 +120,7 @@ bool SunRasterDecoder::readHeader()
|
||||
m_type = IsColorPalette( m_palette, m_bpp ) ? CV_8UC3 : CV_8UC1;
|
||||
m_offset = m_strm.getPos();
|
||||
|
||||
assert( m_offset == 32 + m_maplength );
|
||||
CV_Assert(m_offset == 32 + m_maplength);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ bool SunRasterDecoder::readHeader()
|
||||
|
||||
m_offset = m_strm.getPos();
|
||||
|
||||
assert( m_offset == 32 + m_maplength );
|
||||
CV_Assert(m_offset == 32 + m_maplength);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@@ -226,7 +226,7 @@ bool SunRasterDecoder::readData( Mat& img )
|
||||
code = m_strm.getByte();
|
||||
if( len > line_end - tsrc )
|
||||
{
|
||||
assert(0);
|
||||
CV_Error(CV_StsInternal, "");
|
||||
goto bad_decoding_1bpp;
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ bad_decoding_end:
|
||||
result = true;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
CV_Error(CV_StsInternal, "");
|
||||
}
|
||||
}
|
||||
catch( ... )
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <assert.h> // FIX IT: remove this
|
||||
|
||||
#if defined WIN32 || defined WINCE
|
||||
#if !defined _WIN32_WINNT
|
||||
|
||||
@@ -670,7 +670,7 @@ cvConvertImage( const CvArr* srcarr, CvArr* dstarr, int flags )
|
||||
icvCvt_BGR2Gray_8u_C3C1R( s, s_step, d, d_step, size, swap_rb );
|
||||
break;
|
||||
case 33:
|
||||
assert( swap_rb );
|
||||
CV_Assert(swap_rb);
|
||||
icvCvt_RGB2BGR_8u_C3R( s, s_step, d, d_step, size );
|
||||
break;
|
||||
case 41:
|
||||
|
||||
Reference in New Issue
Block a user