Skip to content
New issue

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

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

Already on GitHub? # to your account

support PiCam (Raspberry Pi Camera) #167

Closed
carandraug opened this issue Sep 17, 2020 · 10 comments
Closed

support PiCam (Raspberry Pi Camera) #167

carandraug opened this issue Sep 17, 2020 · 10 comments

Comments

@carandraug
Copy link
Collaborator

Support the Raspberry Pi Camera (PiCam). Requested by @iandobbie . Initial work on iandobbie's "picam" and "picam-devel" branches.

@carandraug
Copy link
Collaborator Author

@beniroquai : adding you to this issue, since you're planning on implementing support for the picamera first. As we spoke, Ian's most advanced branch to support the picamera was the picam-devel. I just merged master into it and made some adjustments to fit with the current microscope. I suggest you start with the picam-devel branch that it's currently on my fork.

@iandobbie
Copy link
Collaborator

iandobbie commented Dec 11, 2020 via email

@carandraug
Copy link
Collaborator Author

@beniroquai : just checking, are you still planning on implementing the PiCAM in Microscope?

@iandobbie
Copy link
Collaborator

I have done some work on this and got the basic framework in place but I now need some help. The current code is in my repository in wip-picam

I have a trigger which is setup to generate an interrupt from one of the GPIO pins. This currently calls:

def HW_trigger(self,channel):
    '''Function called by GPIO interupt, needs to trigger image capture'''
    print ('PiCam HW trigger')

I want this function to capture an image, with some thing like the software trigger code

        with picamera.array.PiYUVArray(self.camera) as output:
            self.camera.capture(output, format='yuv', use_video_port = False)
            #just return intensity values                                   
            return(output.array[:,:,0])

But not return the array but I guess put it on a queue which _fetch_data then empties, but I know nothing about how best to do queues in python.

@beniroquai
Copy link

Hey, sorry for late reply. I was trying to play with microscope, but had troubles to get the GUI up and running on my machine. I'll definitely come back to it later again. For now I was able to hack a GBRL stage (CNC machine/3D printer), Lasers and Lenses as well as the picamerax from Bowman et al. into the openflexure-server system.
The device adapters should be fairly simple to port again. The GBRL protocol caused me some problems. I'll try to merge the branch and see what I can do on my end here. Compared to the ordinary picamera package, the picamerax has more degrees of freedoms in terms of RAW acquisitions, selecting the gain and flat fielding.

@iandobbie
Copy link
Collaborator

I have now implemented a bare bones driver that does software and hardware triggering. With a test setup I can do software triggering and hardware trigger from a red pitaya. Deals with exposure times, and all standard camera settings (rotation, roi etc...). I will add it to the main branch but it still needs support for

a) the various camera settings
b) different camera modes, image sizes etc....
c) generally tidied up to read GPIO pin from config, etc....

@carandraug
Copy link
Collaborator Author

Are you sure the code works? I see it uses self._logger which has been removed from the base class almost two years ago (with 8f2d2fd). It is also missing a series a few of abstract methods and implements some that are no longer used.

@iandobbie
Copy link
Collaborator

Hi am trying to get back to this again. I have merged my latest version with the current microscope main branch and have the software triggering working. I need to test the hardware trigger. As to the previous comment it now uses _logger which the other camera drivers also seem to use so I assume this is ok, also runs fine with main branch, just replacing the picam.py file.

@iandobbie
Copy link
Collaborator

I have now tested with HW trigger and it still works with that. My branch is at https://github.com/iandobbie/microscope/tree/picam-update

I will keep working on this to add some of the picam config options.

@iandobbie iandobbie reopened this Feb 22, 2022
thomasmfish pushed a commit to thomasmfish/microscope that referenced this issue Jun 1, 2022
@carandraug
Copy link
Collaborator Author

@iandobbie already pushed this a few months ago. Closing as fixed.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

3 participants