Ask Your Question

Mahavir's profile - activity

2020-12-09 10:31:38 -0600 received badge  Nice Answer (source)
2020-12-09 09:46:54 -0600 received badge  Popular Question (source)
2020-12-09 09:44:28 -0600 received badge  Popular Question (source)
2019-07-11 04:49:55 -0600 received badge  Famous Question (source)
2017-07-30 12:37:23 -0600 received badge  Famous Question (source)
2017-07-13 10:33:45 -0600 received badge  Notable Question (source)
2017-02-15 06:15:24 -0600 received badge  Popular Question (source)
2016-06-20 12:24:03 -0600 received badge  Notable Question (source)
2015-11-24 12:39:03 -0600 received badge  Popular Question (source)
2015-03-10 04:05:53 -0600 received badge  Nice Question (source)
2015-02-24 10:40:47 -0600 asked a question avi file is too lagre how to slove the problem?

Hello everyone, I am working on project where I have to read a video, process it frame by frame and again write a video. I am getting problem of large size of output video. My output video takes 20times more space than input video( Duration of video is still same). my output video is in .avi and I used same process of getting codec for video from opencv docs but it didn't work. How to solve the problem??? thanks in advance!!!

2015-02-16 08:45:41 -0600 received badge  Teacher (source)
2015-02-14 12:56:18 -0600 commented answer reading csv file in opencv

@ steven Thank you...

2015-02-14 06:22:20 -0600 commented answer reading csv file in opencv

@ steven when i ran above code in vc2010 it is showing error for while(getline(current_line,single_value,',')) and error is no instance of overloaded function getline matches argument list.

2015-02-14 03:57:16 -0600 asked a question reading csv file in opencv

Hello everyone I want to write code in opencv for reading csv file in opencv. I have csv file(which i directly got from MS excel) and I want to read it and store it in a array. My csv files has 2 rows and 108 colums. How to do that? Thanks in advance!!!

            #include <opencv2\highgui\highgui.hpp>
            #include <opencv2\core\core.hpp>
            #include <opencv2\core\mat.hpp>
            #include <opencv2\imgproc\imgproc.hpp>
            #include<opencv2\features2d\features2d.hpp>
            #include<iostream>
            #include<math.h>
            #include<conio.h>
            #include<fstream>
            #include<sstream>
            using namespace std;
            using namespace cv;
            char filename[80];

             int main()
            {
                ifstream reader;
                Mat vect=Mat::zeros(2,108,CV_8U);
                reader.open("periods of arnold transform.csv");
                //What to do from this onwards???
                return 0;
            }
2015-02-13 11:45:35 -0600 received badge  Supporter (source)
2015-02-13 11:45:33 -0600 received badge  Scholar (source)
2015-02-13 11:45:25 -0600 commented question Blurring of image in resizing

I was resizing as resize(imcap,imcap,Size(81,81),0,0,1); dst and input image names were same so I was getting blured image but now by different dst, problem is resolved..

2015-02-13 11:42:50 -0600 commented answer Blurring of image in resizing

@ thdrksdfthmn Thanks a lot..problem is resolved !!!!

2015-02-13 04:45:33 -0600 asked a question Blurring of image in resizing

Hello everyone I am doing project on video watermarking where i have to resize given watermark several times from arbitrary values say 81x81 to 84x84 to 78x78. I have used resize function each time but watermark is getting blurred and looking bad. How to resize it without getting blurred? Thanks in advance!!!

2015-02-07 05:24:20 -0600 received badge  Self-Learner (source)
2015-02-07 05:18:21 -0600 commented question Anold Transform

Hello Everyone, I have written an adaptive algorithm for arnold transform. Here we have to give only order of image from 2 to 100 and algorithm calculates respective period of AT, encryption and decryption iterations. I have calculated periods of AT for 2 to 100 image size and stored in .csv file. I am very much thankful to StevenPuttemans for his help in 'reading .csv file part'.

Order of image: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

Respective Period of AT : 12 12 12 10 12 16 12 12 30 10 12 14 24 20 12 18 12 18 38 36 56 60 40 48 44 45 60 48 48 36 56 150 36 42 54 36 40 48 36 42 58 60 60 45 48 48 70 60 68 36 48 120 35 36 74 114 100 36 40 84 39 60 108 60 84 48 90 132 56 60 44 60 56 48 60 48 90 48 98 60 60 150

            #include <opencv2\highgui\highgui.hpp>
            #include <opencv2\core\core.hpp>
            #include <opencv2\core\mat.hpp>
            #include <opencv2\imgproc\imgproc.hpp>
            #include<opencv2\features2d\features2d.hpp>
            #include<iostream>
            #include<math.h>
            #include<conio.h>
            #include<fstream>
            #include<sstream>
            #include<string>
            using namespace std;
            using namespace cv;
            char filename[80];

            class image
            {
            public:
                Mat im,vect_look,temp;
                int period,enciter,deciter,wmr;
                double m,x,x1,y,y1; 
                int getim();
            };

            int image::getim()
            {
               im=imread("Caption.png",0);
               threshold(im,im,128,255,THRESH_BINARY);
               if (im.empty()) 
                {
                  cout << "Error : Image cannot be loaded..!!" << endl;
                  return -1;
                }
               cout<<"\nEnter the order of image between 2 to 128 for resizing";
               cin>>wmr;
               resize(im.clone(),im,Size(wmr,wmr),0.0,0.0,1);
               imshow("Input Resized Image",im);
               temp=Mat::zeros(im.size(),im.type());

  // Reading CSV file which contains periods of Arnold Transform for given order of image

               ifstream inputfile("periods of AT.csv");
                string current_line;
                vector< vector<int> > all_data;
                while(getline(inputfile, current_line))
                {   
                   vector<int> values;
                   stringstream temp(current_line);
                   string single_value;
                   while(getline(temp,single_value,','))
                   {
                        values.push_back(atoi(single_value.c_str()));
                   }
                   all_data.push_back(values);
                }
                // Copying values from vector to matrix
                vect_look = Mat::zeros((int)all_data.size(), (int)all_data[0].size(), CV_8UC1);
                for(int rows = 0; rows < (int)all_data.size(); rows++)
                {
                   for(int cols= 0; cols< (int)all_data[0].size(); cols++)
                   {
                      vect_look.at<uchar>(rows,cols) = all_data[rows][cols];
                   }
                }


                 for(int look_count=0;look_count<vect_look.cols;look_count++)
                 {
                    if(vect_look.at<uchar>(0,look_count)==wmr)
                    {
                        period=vect_look.at<uchar>(1,look_count);
                        break;
                    }
                 }
                 // Assign values to encryption and decryption iterations 

               cout<<"\n\nPeriod of Arnold Transform for ...
(more)
2015-02-03 00:54:16 -0600 received badge  Enthusiast
2015-02-02 04:11:36 -0600 asked a question Anold Transform

Hello every one, I have written code for image scrambling and inverse scrambling using Arnold transform. Inputs: 1. number of iterations for scrambling is any arbitary number between 0 and period of Arnold transform for the given size=enciter. 2. number of iterations for inverse scrambling=>deciter = period-enciter. for 128x128 image period of arnold transform is 96. Refer relevant pepper of arnold tranform for periods of different sizes .

            #include <opencv2\highgui\highgui.hpp>
            #include <opencv2\core\core.hpp>
            #include <opencv2\core\mat.hpp>
            #include <opencv2\imgproc\imgproc.hpp>
            #include<opencv2\features2d\features2d.hpp>
            #include<iostream>
            #include<math.h>
            #include<conio.h>
            using namespace std;
            using namespace cv;

            class image
            {
            public:
                Mat im,im1,im2,im3,cs,im_enc,frame;
                int getim();

            };

            int image::getim()
            {
               im=imread("Caption.png",0);
               if (im.empty()) 
                {
                  cout << "Error : Image cannot be loaded..!!" << endl;
                  return -1;
                }
                    resize(im,im,Size(128,128),0.0,0.0,1);
               imshow("Input Image",im);
               Mat temp=Mat::zeros(im.size(),im.type());
               double m=im.rows,x,x1,y,y1; 
               int enciter=50;
               int deciter=96-enciter;
               for(int iter=0;iter<enciter;iter++)
               {
                for(double i=0;i<m;i++)
                {
                   for(double j=0;j<m;j++)
                   {
                       x=fmod((i+j),m);   
                       y=fmod((i+2*j),m);            
                       temp.at<uchar>(x,y)=im.at<uchar>(i,j);
                   }
                }
                temp.copyTo(im);
                temp=Mat::zeros(im.size(),im.type());
               }
              imshow("Scrambled Image",im);
              for(int iter=0;iter<deciter;iter++)
               {
                for(double i=0;i<m;i++)
                {
                   for(double j=0;j<m;j++)
                   {
                       x=fmod((i+j),m);   
                       y=fmod((i+2*j),m);            
                       temp.at<uchar>(x,y)=im.at<uchar>(i,j);
                   }
                }
                temp.copyTo(im);
                temp=Mat::zeros(im.size(),im.type());
               }
              imshow("Inverse Scrambled Image",im);
              waitKey(0);
              return 0;

            }

            int main()
            {
                image my;
                my.getim();
                return 0;
            }

image description

2015-01-12 05:04:55 -0600 asked a question hessian laplace detector

Hello, I want to implement Hessian Laplace Detector and using information which i got while net browsing i did following step

  1. I took image and did gaussian filtering with initial scale sigma0;
  2. then I formed hessian matrix H[Ixx,Ixy;Iyx,Iyy]
  3. I calculated trace of hessian and stored in it LoG array
  4. I did above steps for 5 iterations and each time i increased sigma as sigma=sigma0*1.3;
  5. I found maximum value of LoG array and value of sigma for that max LoG . I saved it as char_scale.
  6. I obtained respective Hessian matrix for above char_scale and located points which are local extremas of Det(hessian) and Trace(hessian) ; is this procedure correct or not? please reply!!!
2014-12-29 05:15:54 -0600 asked a question How to read images sequentially?

Hello, I am trying to read images from folder ("C:\Users\MAHAVIR\Documents\Visual Studio 2010\Projects\Video_Watermarking\caption"). I have written 119 images to this folder and I want to read each image one by one.

When i tried by using VideoCapture I got following error

enter image description here
How to solve the problem?

2014-12-09 03:33:41 -0600 asked a question Video Processing using opencv in TMS320C6748

Hello Everyone, Can anybody tell me how to use opencv for programming TMS320C6748 DSP processor.

2014-10-17 03:00:28 -0600 asked a question How to test video under various attacks?

Hello everyone,

I am doing project on video watermarking. I am able to insert and extract watermark from video frames. I want to test my algorithm under various noise and filtering attacks. How to add noise to video frames. I am doing color video watermarking and adding watermarking in R channel.

Thanks in advance!!!

2014-09-24 07:37:35 -0600 edited question Wavelet Transform

Hello, I have done haar wavelet transform in opencv. the code is as below

            #include <opencv2\highgui\highgui.hpp>
            #include <opencv2\core\core.hpp>
            #include <opencv2\core\mat.hpp>
            #include <opencv2\imgproc\imgproc.hpp>
            #include<iostream>
            #include<math.h>
            #include<conio.h>
            using namespace std;
            using namespace cv;

            class image
            {
            public:
                Mat im,im1,im2,im3,im4,im5,im6,temp,im11,im12,im13,im14,imi,imd,imr;
                float a,b,c,d;
                int getim();
            };

            int image::getim()
            {
                im=imread("lena.jpg",0); //Load image in Gray Scale
                imi=Mat::zeros(im.rows,im.cols,CV_8U);
                im.copyTo(imi);

                im.convertTo(im,CV_32F,1.0,0.0);
                im1=Mat::zeros(im.rows/2,im.cols,CV_32F);
                im2=Mat::zeros(im.rows/2,im.cols,CV_32F);
                im3=Mat::zeros(im.rows/2,im.cols/2,CV_32F);
                im4=Mat::zeros(im.rows/2,im.cols/2,CV_32F);
                im5=Mat::zeros(im.rows/2,im.cols/2,CV_32F);
                im6=Mat::zeros(im.rows/2,im.cols/2,CV_32F);

                //--------------Decomposition-------------------

                for(int rcnt=0;rcnt<im.rows;rcnt+=2)
                {
                    for(int ccnt=0;ccnt<im.cols;ccnt++)
                    {

                        a=im.at<float>(rcnt,ccnt);
                        b=im.at<float>(rcnt+1,ccnt);
                        c=(a+b)*0.707;
                        d=(a-b)*0.707;
                        int _rcnt=rcnt/2;
                        im1.at<float>(_rcnt,ccnt)=c;
                        im2.at<float>(_rcnt,ccnt)=d;
                    }
                }

                for(int rcnt=0;rcnt<im.rows/2;rcnt++)
                {
                    for(int ccnt=0;ccnt<im.cols;ccnt+=2)
                    {

                        a=im1.at<float>(rcnt,ccnt);
                        b=im1.at<float>(rcnt,ccnt+1);
                        c=(a+b)*0.707;
                        d=(a-b)*0.707;
                        int _ccnt=ccnt/2;
                        im3.at<float>(rcnt,_ccnt)=c;
                        im4.at<float>(rcnt,_ccnt)=d;
                    }
                }

                for(int rcnt=0;rcnt<im.rows/2;rcnt++)
                {
                    for(int ccnt=0;ccnt<im.cols;ccnt+=2)
                    {

                        a=im2.at<float>(rcnt,ccnt);
                        b=im2.at<float>(rcnt,ccnt+1);
                        c=(a+b)*0.707;
                        d=(a-b)*0.707;
                        int _ccnt=ccnt/2;
                        im5.at<float>(rcnt,_ccnt)=c;
                        im6.at<float>(rcnt,_ccnt)=d;
                    }
                }

                imr=Mat::zeros(256,256,CV_32F);
                imd=Mat::zeros(256,256,CV_32F);
                im3.copyTo(imd(Rect(0,0,128,128)));
                im4.copyTo(imd(Rect(0,127,128,128)));
                im5.copyTo(imd(Rect(127,0,128,128)));
                im6.copyTo(imd(Rect(127,127,128,128)));


                //---------------------------------Reconstruction-------------------------------------

                im11=Mat::zeros(im.rows/2,im.cols,CV_32F);
                im12=Mat::zeros(im.rows/2,im.cols,CV_32F);
                im13=Mat::zeros(im.rows/2,im.cols,CV_32F);
                im14=Mat::zeros(im.rows/2,im.cols,CV_32F);

                for(int rcnt=0;rcnt<im.rows/2;rcnt++)
                {
                    for(int ccnt=0;ccnt<im.cols/2;ccnt++)
                    {
                        int _ccnt=ccnt*2;
                        im11.at<float>(rcnt,_ccnt)=im3.at<float>(rcnt,ccnt);     //Upsampling of stage I
                        im12.at<float>(rcnt,_ccnt)=im4.at<float>(rcnt,ccnt);
                        im13.at<float>(rcnt,_ccnt)=im5.at<float>(rcnt,ccnt);
                        im14.at<float>(rcnt,_ccnt)=im6.at<float>(rcnt,ccnt);
                    }
                }


                for(int rcnt=0;rcnt<im.rows/2;rcnt++)
                {
                    for(int ccnt=0;ccnt<im.cols;ccnt+=2)
                    {

                        a=im11.at ...
(more)
2014-09-22 02:46:45 -0600 asked a question How to do SVD back substitution

I am applying SVD on image using opencv 2.4.9 command SVDecomp. at the time of back substitution it asks rhs array.What is that array and how to get it?

commands:

 1. cv::SVDecomp(im_enc1,w,u,vt);

where w,u,vt are SVD components and im_enc1 is inputimage.

 2. cv::SVBackSubst(w,u,vt,rhs,im_enc2);

where w,u,vt are SVD components and im_enc2 is output image.

2014-09-22 02:41:44 -0600 commented question Wavelet Transform

I have no question about Wavelet. I gave this so that others can use it. I have question of SVD 1. cv::SVDecomp(im_enc1,w,u,vt);

where w,u,vt are SVD components and im_enc1 is input image.

 2. cv::SVBackSubst(w,u,vt,rhs,im_enc2);

where w,u,vt are SVD components and im_enc2 is output image. what is rhs array and how to get it?