Ask Your Question

SindhuMegha's profile - activity

2018-05-05 08:51:44 -0600 received badge  Notable Question (source)
2016-04-15 08:27:40 -0600 received badge  Popular Question (source)
2015-03-23 04:03:38 -0600 received badge  Good Question (source)
2014-12-29 04:04:48 -0600 received badge  Famous Question (source)
2014-05-20 23:26:51 -0600 received badge  Notable Question (source)
2014-01-29 06:50:35 -0600 received badge  Popular Question (source)
2013-09-21 09:27:53 -0600 received badge  Nice Question (source)
2013-06-19 13:37:04 -0600 asked a question GLCM Error..

//#include "_cvaux.h" Hi, This is the source code I have used to extract Texture features.. this source code I got from some web site.... Its not working for multiple images.. getting error... Pls help me.. // void __cdecl _unlock ( int locknum ) { /* * leave the critical section. */ LeaveCriticalSection( _locktable[locknum].lock ); }

//

//#include "legacy.h"

include <opencv\cv.h>

include <opencv\cvaux.h>

include <opencv\highgui.h>

include <opencv2\legacy\legacy.hpp>

using namespace cv; using namespace std; //#include "opencv2\precomp.hpp"

define CV_MAX_NUM_GREY_LEVELS_8U 256

struct CvGLCM { int matrixSideLength; int numMatrices; double* matrices;

int numLookupTableElements; int forwardLookupTable[CV_MAX_NUM_GREY_LEVELS_8U]; int reverseLookupTable[CV_MAX_NUM_GREY_LEVELS_8U];

double** descriptors; int numDescriptors; int descriptorOptimizationType; int optimizationType; };

static void icv_CreateGLCM_LookupTable_8u_C1R( const uchar* srcImageData, int srcImageStep, CvSize srcImageSize, CvGLCM* destGLCM, int* steps, int numSteps, int* memorySteps );

static void icv_CreateGLCMDescriptors_AllowDoubleNest( CvGLCM* destGLCM, int matrixIndex );

CvGLCM* cvCreateGLCM( const IplImage* srcImage, int stepMagnitude, const int* srcStepDirections,/* should be static array..or if not the user should handle de-allocation */ int numStepDirections, int optimizationType ) { static const int defaultStepDirections[] = { 0,1,-1,1,-1,0,-1,-1 };

int* memorySteps = 0; CvGLCM* newGLCM = 0; int* stepDirections = 0;

CV_FUNCNAME( "cvCreateGLCM" );

__BEGIN__;

uchar* srcImageData = 0; CvSize srcImageSize; int srcImageStep; int stepLoop; const int maxNumGreyLevels8u = CV_MAX_NUM_GREY_LEVELS_8U;

if( !srcImage ) CV_ERROR( CV_StsNullPtr, "" );

if( srcImage->nChannels != 1 ) CV_ERROR( CV_BadNumChannels, "Number of channels must be 1");

if( srcImage->depth != IPL_DEPTH_8U ) CV_ERROR( CV_BadDepth, "Depth must be equal IPL_DEPTH_8U");

// no Directions provided, use the default ones - 0 deg, 45, 90, 135 if( !srcStepDirections ) { srcStepDirections = defaultStepDirections; }

//CV_CALL( stepDirections = (int)cvAlloc(numStepDirections2sizeof(stepDirections[0]))); CV_CALL( stepDirections = new int [numStepDirections2sizeof(stepDirections[0])]); memcpy( stepDirections, srcStepDirections, numStepDirections2*sizeof(stepDirections[0]));

cvGetImageRawData( srcImage, &srcImageData, &srcImageStep, &srcImageSize );

// roll together Directions and magnitudes together with knowledge of image (step) // CV_CALL( memorySteps = (int)cvAlloc(numStepDirectionssizeof(memorySteps[0]))); CV_CALL( memorySteps = new int [ numStepDirections*sizeof(memorySteps[0]) ]);

for( stepLoop = 0; stepLoop < numStepDirections; stepLoop++ ) { stepDirections[stepLoop2 + 0] *= stepMagnitude; stepDirections[stepLoop2 + 1] *= stepMagnitude;

memorySteps[stepLoop] = stepDirections[stepLoop2 + 0]srcImageStep + stepDirections[stepLoop*2 + 1]; }

//CV_CALL( newGLCM = (CvGLCM*)cvAlloc(sizeof(newGLCM))); CV_CALL( newGLCM = new CvGLCM [sizeof(newGLCM)] ); memset( newGLCM, 0, sizeof(newGLCM) );

newGLCM->matrices = 0; newGLCM->numMatrices = numStepDirections; newGLCM->optimizationType = optimizationType;

if( optimizationType <= CV_GLCM_OPTIMIZATION_LUT ) { int lookupTableLoop, imageColLoop, imageRowLoop, lineOffset = 0;

// if optimization type is set to lut, then make one for the image if( optimizationType == CV_GLCM_OPTIMIZATION_LUT ) { for( imageRowLoop = 0; imageRowLoop < srcImageSize.height; imageRowLoop++, lineOffset += srcImageStep ) { for( imageColLoop = 0; imageColLoop < srcImageSize.width; imageColLoop++ ) {

newGLCM->forwardLookupTable[srcImageData[lineOffset+imageColLoop]]=1; } }

newGLCM->numLookupTableElements = 0;

for( lookupTableLoop = 0; lookupTableLoop < maxNumGreyLevels8u; lookupTableLoop++ ) { if( newGLCM->forwardLookupTable[ lookupTableLoop ] != 0 ) { newGLCM->forwardLookupTable[ lookupTableLoop ] = newGLCM->numLookupTableElements; newGLCM->reverseLookupTable[ newGLCM->numLookupTableElements ] = lookupTableLoop;

newGLCM->numLookupTableElements++; } } } // otherwise make a "LUT" which contains all the gray-levels (forcode-reuse) else if( optimizationType == CV_GLCM_OPTIMIZATION_NONE ) { for( lookupTableLoop = 0; lookupTableLoop <maxnumgreylevels8u; lookuptableloop++="" )="" {="" newglcm-="">forwardLookupTable[ lookupTableLoop ] = lookupTableLoop; newGLCM->reverseLookupTable[ lookupTableLoop ] = lookupTableLoop; } newGLCM->numLookupTableElements = maxNumGreyLevels8u; }

newGLCM->matrixSideLength = newGLCM->numLookupTableElements; icv_CreateGLCM_LookupTable_8u_C1R( srcImageData, srcImageStep,srcImageSize,newGLCM, stepDirections,numStepDirections, memorySteps ); } else if( optimizationType == CV_GLCM_OPTIMIZATION_HISTOGRAM ) { CV_ERROR( CV_StsBadFlag, "Histogram-based method is not implemented" );

/* newGLCM->numMatrices = 2; newGLCM->matrixSideLength = maxNumGreyLevels8u2;

icv_CreateGLCM_Histogram_8uC1R( srcImageStep, srcImageSize, srcImageData, newGLCM, numStepDirections, stepDirections, memorySteps ); */ }

__END__;

delete[] memorySteps; delete[] stepDirections;

if( cvGetErrStatus() < 0 ) { cvFree( &newGLCM ... (more)

2013-06-19 12:32:35 -0600 asked a question Memory allocation error GLCM opencv c++

Hi, I am new to openCV,, I am using gray level co-occurrence matrix to extract texture features.. I am getting error while extracting features for multiple images. Pls Help me.........

void __cdecl _unlock ( int locknum ) { /* * leave the critical section. */ LeaveCriticalSection( _locktable[locknum].lock ); }

ifdef _M_IX86

pragma optimize("y",on)

endif /* _M_IX86 */

/* *_lockerr_exit() - Write error message and die


2013-06-12 03:12:22 -0600 commented answer read multiple images from folder and concat, display images in single window opencv c++, visual studio 2010

Thanks a lot:).. Its working perfectly... vconcat & hconcat are functions of opencv to concat two images horizantally and vertical........

2013-05-24 14:31:39 -0600 received badge  Student (source)
2013-05-24 12:08:21 -0600 asked a question read multiple images from folder and concat, display images in single window opencv c++, visual studio 2010

Hi,I' m new to opencv c++, I need to concat multiple images and display it in single window. Here the source code i hv done,I m reading images from folder and resizing images to thumbnail size,Now i want to concat thumbnail sized multile images and copy into Big Image(Mat image). But my source code, multiple images are not concatinating, What's wrong with the code?..Pls help me...

FILE* f;
using namespace cv;
using namespace std;
int main()
{
    IplImage *desimg,*srcimg;
    Mat output,src,tumbnail1;
    srcimg=cvLoadImage("E:\\images\\img\\b1.jpg",1);
    output=cvCreateMat(srcimg->width,srcimg->height,3);

    //load multiple images....................
    //File finding objects
    struct _finddata_t c_file;

    long hFile;
    int value_max,value,height,width;
    char imageDirectory[] = "E:\\images\\img";
    char imageFileType[] = "jpg";
    char fullImagePath[1000];
    char buffer[1000];  
    sprintf(buffer,"%s\\*.%s", imageDirectory, imageFileType);
    hFile = _findfirst( buffer, &c_file );
    /*Check to make sure that there are files in directory*/
    if( hFile == -1L )
        printf( "No %s files in current directory!\n", imageFileType );
    else
    {   
        // List all files in directory
        printf( "Listing of files:\n" );
        // Loop through all images of imageFileType
        do  
        {   
            // Show file name
            printf( "\nOpening File: %s \n", c_file.name);

            sprintf(fullImagePath,"%s\\%s", imageDirectory, c_file.name);

            // Load image
            desimg = cvLoadImage(fullImagePath);

            Mat src1=cv::cvarrToMat(desimg); //convert ipl img to mat
            Mat src2=cv::cvarrToMat(srcimg);

            cv::Mat tumbnails2;

            tumbnail1=cvCreateMat(src1.rows/10,src1.cols/10,3);
            tumbnails2=cvCreateMat(src2.rows/10,src2.cols/10,3);

            cv::resize(src1, tumbnails2,tumbnails2.size());
            cv::resize(src2, tumbnail1,tumbnail1.size());
            //tumbnails1.push_back(tumbnails2);
            vconcat(tumbnail1,tumbnails2,output);

        } while( _findnext( hFile, &c_file ) == 0 );

        // Close file finder object
        _findclose( hFile );
    }

    imshow("concatenation of multiple images",output);
    waitKey(0);

    return 0;
}
2013-05-23 14:09:18 -0600 commented answer opencv -display multiple images in single window

Thank u all:).. Its working fine, using hconcat and vconcat functions.But its working only if the images are equal size..

2013-05-22 08:48:07 -0600 received badge  Scholar (source)
2013-05-22 08:48:04 -0600 received badge  Critic (source)
2013-05-22 03:58:40 -0600 asked a question opencv -display multiple images in single window

Hi,I m new to opencv c++,I am doing my academic project on content based image retrieval using opencv visual studio c++, I need to display input query image in one window and similar images to given input images(so multiple images) in another window.Pls any one help me....

Thanking You