Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GVSTream object is not callable #875

Open
pechavarri opened this issue Feb 28, 2024 · 0 comments
Open

GVSTream object is not callable #875

pechavarri opened this issue Feb 28, 2024 · 0 comments
Labels
2. Needs informations Needs additional informations 5. Python Issue in python binding

Comments

@pechavarri
Copy link

pechavarri commented Feb 28, 2024

Describe the bug
I am trying to capture with profiler but when doing "stream.pop_buffer ()" Stream says: "GVSTream object is not callable"

Here is the code:

import sys
import gi
import numpy as np
import ctypes
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from PIL import Image as im 
import cv2
import time


gi.require_version('Aravis', '0.8')

from gi.repository import Aravis

Aravis.enable_interface ("Fake")

try:
    if len(sys.argv) > 1:
        camera = Aravis.Camera.new (sys.argv[1])
    else:
        camera = Aravis.Camera.new ('192.168.100.200')
except TypeError:
	print ("No camera found")
	exit ()

payload = camera.get_payload ()


[x,y,width,height] = camera.get_region ()

stream = camera.create_stream (None, None)      

for i in range(0,1024):
	stream.push_buffer (Aravis.Buffer.new_allocate (payload))

print ("Start acquisition")

camera.start_acquisition ()

filas=1024
array_intensity= np.empty((filas,2048))

print ("Acquisition")

for i in range(0,filas):
	inicio=time.time()
	image = stream.pop_buffer ()
	data=image.get_part_data(1)
	f=image.get_part_pixel_format(1)
	if f==17825795: 
			#arr2=np.ctypeslib.as_array(ctypes.cast(data, ctypes.POINTER(ctypes.c_int16)),(width,)).copy()
			array_intensity[i]=np.ctypeslib.as_array(ctypes.cast(data, ctypes.POINTER(ctypes.c_short)),(width,)).copy()
			#min_i=np.amin(array_intensity)
			#max_i=np.amax(array_intensity)
				
	stream.push_buffer(image)			
	#array_intensity=np.vstack((array_intensity,arr2)) 
	fin=time.time()

tiempo=fin-inicio
print('fps:', 1/tiempo)

#array_intensity=np.delete(array_intensity,0,0)
print('array:',array_intensity)
image_2D=im.fromarray(array_intensity) 
image_2D.show() 


print ("Stop acquisition")

camera.stop_acquisition ()
@EmmanuelP EmmanuelP added 5. Python Issue in python binding 2. Needs informations Needs additional informations labels Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. Needs informations Needs additional informations 5. Python Issue in python binding
Projects
None yet
Development

No branches or pull requests

2 participants