Accesing Memory Address

asked 2015-06-18 06:14:59 -0500

spinter696 gravatar image

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


edit retag flag offensive close merge delete


First off all, remove the pointers in the OpenCV2.x interface. OpenCV uses some sort of smart pointers that do not need this explicit pointers. If you do than very unexpected things happen. The second part of your problem is actually a python problem, not sure if you will find the answer here.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-18 09:47:05 -0500 )edit

btw, your library will have to return a numpy array, not a pointer to cv::Mat.

maybe have a look, how opencv handles this

berak gravatar imageberak ( 2015-06-18 09:58:38 -0500 )edit