Ask Your Question

spinter696's profile - activity

2019-07-01 02:40:35 -0600 received badge  Famous Question (source)
2019-01-09 13:19:18 -0600 received badge  Popular Question (source)
2017-09-08 07:44:45 -0600 received badge  Notable Question (source)
2017-07-07 06:26:34 -0600 received badge  Nice Question (source)
2017-02-08 09:58:19 -0600 received badge  Popular Question (source)
2015-06-18 06:14:59 -0600 asked a question Accesing Memory Address

Well I will explain my problem I am using a wrapper from a c++ to a python program that retrieve a frame from a camera an store it on a Mat*, but when I try to obtain the image in the python script what I am obtaining is a memory address and no the information of the image itself.

Anyone know how can I solve it?

I show my main scrip and the terminal's output

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import cv2
import time
import ctypes
from biblioteca import lib

objectInstance = lib.classInstance();

initializace = lib.initializeCamera(objectInstance);

print initializace

frame = lib.getFrame(objectInstance)
frame = lib.getFrame(objectInstance)
print frame
time.sleep(5)
lib.freeClass(objectInstance)

Output:

1878271672
2015-05-26 05:30:06 -0600 commented question How I can adapt this code to opencv 3.0.0

Thanks berak, failing in the last variable..... solved

2015-05-26 04:06:38 -0600 asked a question How I can adapt this code to opencv 3.0.0
IplImage* tmpImg=cvCreateImageHeader(cvSize(imX,imY),IPL_DEPTH_8U,1);
tmpImg->imageData=m_pcImageMemory;

I tried a lot but I am not able to adapt correctly the code

this is the last one I have

Mat tmpImg = Mat(imX,mY,CV_8U,1);
tmpImg->=m_pcImageMemory

thanks in advance

2015-05-15 05:23:36 -0600 received badge  Enthusiast
2015-05-14 06:02:19 -0600 commented question Any idea for that code that is failing on execution???

Invalid buffer size.

2015-05-14 05:16:05 -0600 commented question Any idea for that code that is failing on execution???

failing mean, giving the error option no grabbing the frame

2015-05-14 04:13:42 -0600 asked a question Any idea for that code that is failing on execution???

I am on an uEye XS camera in a raspberry pi trying to grab a simple frame and showing it with opencv

#include <uEye.h>
#include <ueye_deprecated.h>
#include <wchar.h>
#include <locale.h>
#include <stdlib.h>
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>


using namespace std;
using namespace cv;

int main(int argc, char *argv[])
{


 HIDS hCam = 0;
 char* imgMem;
 int memId;
 if(is_InitCamera (&hCam, NULL)!= IS_SUCCESS){
   return 0;
 }

 int img_width=640, img_height=360, img_bpp=24;
 is_AllocImageMem(hCam, img_width, img_height, img_bpp, &imgMem, &memId);
 is_SetImageMem (hCam, imgMem, memId);
 is_SetDisplayMode (hCam, IS_SET_DM_DIB);
 is_SetImageSize (hCam, img_width, img_height);

 printf("Camara: %d",hCam); 



for(int ii=0; ii<1; ii++)
{
   if(is_FreezeVideo(hCam, IS_WAIT) == IS_SUCCESS){
        void *pMemVoid; //pointer to where the image is stored
        is_GetImageMem (hCam, &pMemVoid);
        Mat image(360,640,CV_8UC3,(uchar*)pMemVoid);

    //now you can use your img just like a normal OpenCV image
        namedWindow( "A", 1 );
        imshow("A",image);
        waitKey(0);
   }
   else{
    printf("Error ocurred");
   }
}

is_ExitCamera(hCam);

}
2015-05-11 05:56:14 -0600 commented answer Problem with IPL image and imshow

I have libs under /usr/lib g++ -Wall -I/usr/lib -o main main.cpp -L/usr/lib -lueye_api -lopencv_core -lopencv_imgproc -lopencv_highgui

that will be the correct one???

2015-05-11 05:46:30 -0600 commented answer Problem with IPL image and imshow

Linking in that way libraries give me the same error

2015-05-11 05:32:54 -0600 commented answer Problem with IPL image and imshow

I tryed that befores posting butI obtain the next error: /tmp/ccxslput.o: In the function main': main.cpp:(.text+0x354): reference tocv::namedWindow(cv::String const&, int)' without definition main.cpp:(.text+0x398): reference to cv::imshow(cv::String const&, cv::_InputArray const&)' without definition main.cpp:(.text+0x3b8): reference tocv::waitKey(int)' without definition /tmp/ccxslput.o: In the function cv::String::String(char const*)': main.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x4c): reference tocv::String::allocate(unsigned int)' without definition /tmp/ccxslput.o: In the functioncv::String::~String()': main.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x14): reference tocv::String::deallocate()' without definition /tmp/ccxslput.o: En la funciĆ³n `cv::Mat::Mat(int, int, int, void*, unsigned int)

2015-05-11 04:34:23 -0600 asked a question Problem with IPL image and imshow

Hi I want to show an IPL image created but with imshow I am having problems, I was searching how to solve that error but I didn't find anything.... so if someone could help me I would be very please. I am in a raspberry pi, using opencv 3.0.0 I know is better use Mat know but I didnt know hot to convert an Image captured by other API to a Mat object and not and IPL

#include <uEye.h>
#include <ueye_deprecated.h>
#include <wchar.h>
#include <locale.h>
#include <stdlib.h>
#include <stdio.h>
#include <opencv2/highgui/highgui.hpp>

using namespace std;
using namespace cv;

int main(int argc, char *argv[])
{
rest of code

if(is_FreezeVideo(hCam, IS_WAIT) == IS_SUCCESS){
        void *pMemVoid; //pointer to where the image is stored
        is_GetImageMem (hCam, &pMemVoid);
        IplImage * img;
        img=cvCreateImage(cvSize(img_width, img_height), IPL_DEPTH_8U, 3); 
        img->nSize=112;
        img->ID=0;
        img->nChannels=3;
        img->alphaChannel=0;
        img->depth=8;
        img->dataOrder=0;
        img->origin=0;
        img->align=4;
        img->width=img_width;
        img->height=img_height;
        img->roi=NULL;
        img->maskROI=NULL;
        img->imageId=NULL;
        img->tileInfo=NULL;
        img->imageSize=3*img_width*img_height;
        img->imageData=(char*)pMemVoid;  //the pointer to imagaData
        img->widthStep=3*img_width;
        img->imageDataOrigin=(char*)pMemVoid; //and again
        //now you can use your img just like a normal OpenCV image
        namedWindow( "A", 1 );
        cv::imshow("A",img);
        waitKey(0);
   }
  rest of code
}

Error is the next:

$ g++ -Wall -I/usr/lib -o main main.cpp -lueye_api
main.cpp: In function 'int main(int, char**)':
main.cpp:100:31: error: no matching function for call to 'imshow(const char [2], IplImage*&)'
main.cpp:100:31: note: candidates are:
/usr/local/include/opencv2/highgui.hpp:305:19: note: void cv::imshow(const cv::String&, cv::InputArray)
/usr/local/include/opencv2/highgui.hpp:305:19: note:   no known conversion for argument 2 from        'IplImage* {aka _IplImage*}' to 'cv::InputArray {aka const cv::_InputArray&}'
/usr/local/include/opencv2/highgui.hpp:488:17: note: void cv::imshow(const cv::String&, const     cv::ogl::Texture2D&)
/usr/local/include/opencv2/highgui.hpp:488:17: note:   no known conversion for argument 2 from 'IplImage* {aka _IplImage*}' to 'const cv::ogl::Texture2D&'
2015-04-29 05:03:36 -0600 received badge  Editor (source)
2015-04-29 04:25:45 -0600 asked a question uEye working with OpenCV in python?

Hi, just asking for information no work done.

Anyone know if the uEye XS (which works with Raspberry Pi) can be used to retrieve images using OpenCV Python 3.0.0 and that kind of camera????

Useful information or links related would be helpful.

Thank in advance.

2015-04-27 04:04:29 -0600 received badge  Student (source)
2015-03-09 05:47:46 -0600 asked a question Converting image to uint8 for working with houghcircles

Hi,

I explain my problem, I am using python opencv 3.0.0 and sci-kit lib.

I am trying to detect circles from images using hough circles but my dataset is not so good, so first of all, I do an adaptive equalization histogram with sci-kit and after I try to detect circles; the problem, the function I used to make the adaptive equalization returns me an uint16 image but Hough circles requires a uint8.

There is some way to convert the image to uint8 after doing the equalization??? Or it exists some function in opencv which does the adaptive equalization?? I was searching but I found nothing. :(

I write my code just down here:

#prerequisites: I use cv2.imread to read an image in img variable

import cv2
import numpy as np
from skim age import exposure

def findCircles(img):
    allCircles = cv2.HoughCircles(img,cv2.HOUGH_GRADIENT,1,10,param1=100,param2=30,minRadius=10,
    maxRadius=40)
    print allCircles


def main():
    img_adapteq=exposure.equalize_adapthist(img)
    findCircles(img_adapteq)

if __name__ == "__main__":
    main()
2015-01-24 06:35:28 -0600 commented question Divide an image into lower regions

Sorry, I hadn't time so I wrote the problem without explaining the problem, I 'll do it right now:

the thing is, I don't know if there is an optimal method in openCV to do the job I wrote, I think the code is not too good. Just asking for another idea.

Thanks.

2015-01-23 07:00:48 -0600 asked a question Divide an image into lower regions

Hi,

I explain my problem, I have an image of MxN and I want ti create regions of lower dimensions. for example I want to divide the image into 4x2, so 8 regions I have the next code:

# Numbers of rows
nRows = 4
# Number of columns
mCols = 2

# Reading image
img = cv2.imread('XXXX')
print img
# Dimensions of the image
sizeX = img.shape[0]
sizeY = img.shape[1]

print sizeX,sizeY
# Tam of Y region
regionY=sizeY/nRows

# Tam of X region 
regionX = sizeX/mCols

# Total of regions
totalRegions = nRows* mCols
name = str(totalRegions)
for v in range (0,totalRegions):
    for i in range(0,mCols):
        for j in range(0, nRows):
            name =  str(totalRegions)
            globals()[name]=img[0+mCols*v:mCols+(mCols*v)-1,
                               0+nRows*(v/nRows):nRows+(nRows*(v/nRows))-1]
            totalRegions += -1
2015-01-15 06:59:26 -0600 asked a question Plot and histrogram

Hi,

I have the next question, after doing some operation I obtained a matrix from an image that I want to plot in an histogram. I used the next function. I am using python +opencv3.0.0:

hist = cv2.calcHist([result],[0],None,[256],[0,256])

But it gives me the following error:

TypeError: images data types = 17 is not supported

What's wrong??? Any ideas???

Thanks in advance.

2015-01-15 06:55:33 -0600 answered a question Rotate image

Ok I will try it thank you guys

2015-01-13 03:52:45 -0600 asked a question Rotate image

I explain the problem. For example, I have a rotated square like a diamond , and I want to have the square in a original position as you can see your laptop's screen for example, http://pullmonkey.com/tag/gems/ and the result I want http://jwilson.coe.uga.edu/emt725/SqT.... So the first step I think is the best one is detect the borders of the image using a filter and after rotating the image basing on, for example, the left border. and putting it vertical to the bottom of the screen.

2015-01-11 12:15:55 -0600 commented question Rotate an image after applying a filter

I mean, for example, I have a rotated square like a diamond , and I want to have the square in a original position as you can see your laptop's screen for example, http://pullmonkey.com/tag/gems/ and the result I want http://jwilson.coe.uga.edu/emt725/SqT.... So the first step I think is the best one is detect the borders of the image using a filter and after rotating the image basing on, for example, the left border. and putting it vertical to the bottom of the screen.

2015-01-02 06:24:26 -0600 asked a question Rotate an image after applying a filter

Well I have the next question, after applying a detection filter (like Sobel or Canny) in the y coordinates, I want to rotate the image until the detected border it is horizontally.

How can I do it??

Thanks.

2014-12-27 12:31:07 -0600 asked a question Crop a different contrast region

Hi,

I am so new with opencv and now I am trying to use the 3.0.0 beta with python, my question is just for getting some indications about how I could do the next work:

I have an image and I want to crop a section of the image that have a different (color) I mean 2 levels of grays, so I though the best method is to obtain the contrast of regions and after applying a threshold to crop the region I want, but I have no idea how to do it so if someone could give me some advices I would be so pleased.

Thanks in advance.