Giter VIP home page Giter VIP logo

pyspectrometer's Introduction

PySpectrometer2 released!! Check it out at: https://github.com/leswright1977/PySpectrometer2

Update Sept 27th 2022 A new Raspberry Pi OS Bullseye compatible version of this software is now available in src/PySpectrometer-3.2! This is a quick ugly hack to simply get this thing working on Bullseye and keep everyone happy, whilst I get time to work on the latest and greatest version of this software.

For now, simply download the contents of 3.2, read the new README file, install the dependencies, uses raspi-config to enable legacy camera support and have fun!

Update Sept 25th 2022 It seems Raspberry Pi OS Bullseye, has broken everything (camera software has significantly changed, peakutils is broken, scipy is broken, and it looks like they are preventing installation of the older versions of the OS!...) :-(

I am in the proceess of a brand new build, which will incorporate all of the features that folk have asked for previously including:

Ditching reliance on too many external libraries (scipy and peakutils).

Ditching the TK interface, for leaner, more maintainable software. Simple key bindings will allow all the functionaility of previous versions. Resizable window for the spectrometer display.

A waterfall display (for those of us measuring changes over time).

Windows compatible filenames for the data.

I may incorporate some other changes as well (time permiting, I will have a look at issues, and see what I can rustle up.

PySpectrometer 2021-03-05

Update 2021-10-30 The software works well on the new Raspberry Pi Zero 2 W!

V3 is now released that can export CSV, and has a peak hold feature! Scroll to bottom for changes!

This program, hardware design, and associated information is Open Source (see Licence), but if you have gotten value from these kinds of projects and think they are worth something, please consider donating: https://paypal.me/leslaboratory?locale.x=en_GB

Raspberry Pi Spectrometer

Screenshot

The PySpectrometer is a Python (OpenCV and Tkinter) implementation of an optical spectrometer. The motivation beind this project was to build a tool that could measure the wavelength of home-made Dye Lasers and perform some fluorescence spectroscopy. Most importantly at a cost that is in reach of everyone!

The hardware is simple and widely avilable and so should be easily to duplicate without critical alignment or difficult construction. The hard work was developing the software.

Resolution/accuracy seems to be +/- a couple of nm or so, pretty reasonable for the price of the hardware, especially when you consider the price of commercial components such as the Hamamatsu C12880MA breakout boards which run north of 300 bucks, and has a resolution of 15nm. Of course, this build is physically much larger, but not enormous!

Visit my Youtube Channel at: https://www.youtube.com/leslaboratory

Videos of this project are here:

Raspberry Pi Spectrometer

Software Update

MINIATURE Raspberry Pi Spectrometer

Hardware

Screenshot

The hardware consists of:

A commercial Diffraction grating Spectroscope https://www.patonhawksley.com/product-page/benchtop-spectroscope

A Raspberry Pi Camera (with an M12 Thread) https://thepihut.com/products/raspberry-pi-camera-adjustable-focus-5mp

A CCTV Lens with Zoom (M12 Thread) (Search eBay for F1.6 zoom lens)

Everything is assembled on an aluminium base (note the Camera is not cooled, the heatsink was a conveniently sized piece of aluminium.)

Screenshot

Screenshot

For the MINIATURE version the hardware is:

Screenshot

A commercial Diffraction grating Pocket Spectroscope: https://www.patonhawksley.com/product-page/pocket-spectroscope

A Raspberry Pi Camera (with an M12 Thread): https://thepihut.com/products/raspberry-pi-camera-adjustable-focus-5mp

M12x0.5 F2.0 Fixed 12mm Focal length Lens: https://www.ebay.co.uk/itm/114551239930

Installation

Developed and tested on: 2021-01-11-raspios-buster-armhf-full.img for anything else your milage may vary!

Rasberry pi 4 and PiCamera Recommended.

(Note the software uses the Linux Video Driver, not the Picam Python module. As a consequence it will work with some webcams on probably any Linux box (Tested on Debian with a random webcam))

First attach the Picam, and enable it with raspi-config

Install the dependencies:

sudo apt-get install python3-opencv

sudo apt-get install python-dev libatlas-base-dev

pip3 install scipy

pip3 install peakutils

Run the program with: python3 pyspectrometer-v1.py

To calibrate, shine 2 Lasers of known wavelength (He-Ne, Argon or DPSS recommended! (Diode Lasers can have wavelengths that can be +/- several nm!)) at a piece of card in front of the spectrometer.

Click the two peaks on the graph, and in each of the boxes enter the corresponding wavelength. Then hit 'Calibrate'. In this example I have Calibrated with 532nm (DPSS) and 633nm He-Ne. The Scale and lablels will then adjust to match your values.

For good accuracy make sure your wavelengths are quite far apart, ideally one at the red end and one at the blue end

Screenshot

Alternatively, you may use a Fluorescent tube (or any other gas discharge tube) in front of the Spectrometer, you will have to research the wavelengths of the emission lines (Mercury for Fluorescent tubes, Neon, Argon, Xenon for other types) That will be an excercise for you!

Other settings

"Label Peak width" and "Label threshold" set the width of a peak to label, and the level to consider it a peak respectively. The Defaults are fine, but if you find the graph too cluttered, you can play with these values.

Snapshot, takes a snapshot of the graph section like this: Screenshot

Example Spectra

Here is an example of the spectrum of a fluorescent bulb. The peaks at 405,435,545,650 are Mercury, Europium (one of the lamp phosphors) is visible at ~610nm.

Screenshot

Measuring the wavelength of a cheap red laser pointer (661nm)

Screenshot

Measuring the wavelength of a cheap violet Laser pointer, note the strong fluorescence from the paper! Paper is optically brightened with a fluorescent dyes, most likely Coumarin.

Screenshot

The spectrum of Daylight (pointed out of the window at a blue sky)

Screenshot

The spectrum of of a Helium-Neon Discharge.

Screenshot

Minimum smoothing applied:

Screenshot

Maximum smoothing applied:

Screenshot

Version 3

Version 3 has a Peak hold feature to detect transient events, such as a Laser pulse, or a Camera Flash!

Screenshot

Pressing the snapshot button also dumps data to a CSV file. This is far more accurate data than the graph window, and can be imported into OpenOffice on the Pi.

Screenshot

Note: Filenames have colons in them. Unix like OS's e.g. Linux have no issue, but you will find that you have to rename these if you want to import to Windows!

Screenshot

Tuning curves obtined from a home-made pulsed Dye Laser. From Left to right: Coumarin-1,Rhodamine 6G, Rhodmine B.

TODO Add in a 3 wavelength Calibration functionality to counteract nonlinearity.

pyspectrometer's People

Contributors

leswright1977 avatar rafl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyspectrometer's Issues

Suitable camera lens

First of all, great project!

Currently I'm running a similar setup as the one shown in your youtube video (using the same spectroscope).
I've tried a random camera lens I already had for the Raspberry HQ cam, but the resulting images are really blurry.

I don't know much about camera lenses, but I think you would need a lens with a very short focus length
to get an accurate image. Do you happen to know the technical specs of the lens you used? Much appreciated!

RPI Zero2 W scipy dependency fails to install

When installing on a zero 2 W, the scipy install dies on numpy. It's a memory issue, since you only have 300 some MB. You'll need to increase the swapfile size, at least temporarily. Alternatively install the dependencies on a full size Pi4 and transfer the folders.

also don't forget to run apt get update.

I followed the instructions at:
https://pimylifeup.com/raspberry-pi-swap-file/

to save some clicks, here's the terminal commands

sudo dphys-swapfile swapoff
sudo nano /etc/dphys-swapfile
ctrl-w
CONF_SWAPSIZE=100
---change 100 to 1024 or 2048. I wasted enough time last night. I changed it to 2048 and it finished in about an hour.
ctrl-x
y
sudo dphys-swapfile setup
sudo dphys-swapfile swapon
----then reboot
sudo reboot

GStreamer: pipeline have not been created

Hello!

Great project! I am just having a bit of an issue with openCV and GStreamer. Any suggestions would be much appreciated

[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (1824) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Failed to allocate required memory.
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (914) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (501) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

How much memory is needed?

Hi, great project, congratulations, could you please let me know which Raspberry Pi 4 version did you use for the project? How much memory? What is the average memory utilization when running the software?

API feature request

I have to do a lot of color measurements on different RGBW led strips. It would be awesome to automate this process. It would be great if I could trigger a measurement externally with maybe a TCP of HTTP(S) command and get the measurements back as JSON (or some other format like comma delimited CSV like). Would you please consider this?

Compatible Pi List

Could you make a list of the Raspberry Pies compatible with this project?

Failed to allocate required memory, unable to start pipeline and pipeline have not been created sratr git rev.

I used a raspaberry pi 4B 32 GB MEMORY CONNECTED to fmcw radar distance 2 Go also connected to the camera and i have this error and i used c++
[ WARN:[email protected]] global ./modules/videoio/src/cap_gstreamer.cpp (2401) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Failed to allocate required memory.
[ WARN:[email protected]] global ./modules/videoio/src/cap_gstreamer.cpp (1356) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:[email protected]] global ./modules/videoio/src/cap_gstreamer.cpp (862) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
sratr git rev.
can you help me please

Near infrared spectrometer ranges from 400nm to 1100nm

Hello leswright 1977, I am an engineer from China; I currently have a laboratory project that needs to use a spectrometer to measure the near infrared spectrum. The spectral range is 400 to 1100nm;; Check the commercial spectrometer, it is too expensive; One is about 10000 RMB; So I want to DIY myself;

I watched your YouTube video, which only supports the spectrum of 400 to 700nm; I found a spectroscope on Taobao, and found that there was only a spectroscope with the wavelength of 400 to 700nm used to identify gemstones; This can not meet my needs, so I contacted you to inquire if there is a spectrometer that can measure 400nm to 1100nm to meet my project;

My email address is [email protected] , looking forward to your reply! A friend from China

Compactness

Really awesome project!

This is huge (in terms of volume).
I think this would be much more useful as a tool, if it was much more compact (say if you could have this easily added to a trichorder etc).

Does anyone reading this have any idea how it could be made more compact?

The internet has some designs for compact spectrometers, but I would be interrested in something even more compact if possible. You can see one such design here for example: https://img.laserfocusworld.com/files/base/ebm/lfw/image/2016/01/1305lfw01f1.png?auto=format&w=720

Could a prism be used instead of the diffraction grating? That sounds like it could be made more compact then.
A very small motor could be used to move (rotate) the prism about if needed, there are minuscule stepper motors around, and I can help with finding and interfacing those if required.

The design of this project (PySpectrometer) looks a lot like this one, am I correct in my understanding there? https://www.hamamatsu.com/sp/ssd/product/Spectrometers/img06_en.png

Stacking mirrors also might have potential by increasing the number of reflections (still using only two mirrors) and therefore widening the prism/spectrum effect: https://media.springernature.com/m685/springer-static/image/art%3A10.1038%2Fs41467-018-06495-5/MediaObjects/41467_2018_6495_Fig1_HTML.png

Something like this has a similar concept to what I'm describing here : https://www.researchgate.net/profile/Manuel-Cano-Garcia/publication/338279737/figure/fig1/AS:845739789938690@1578651487502/Schematic-draw-of-the-proposed-spectrophotometer-An-Arduino-stage-drives-all-the.png but I would think it might be possible to make this even much more compact somehow ... just racking my brain for an engineering solution and have not found one yet. Curious if somebody else reading this would have an idea.

Maybe it could be possible to take advantage of the fact that we have a 2D sensor (instead of the strictly 1D sensor we actually need for spectra), by having several different prisms stacked on top of each other, creating different lines hitting the sensor on top of one another. This should be relatively easy to manufacture: it is simply a pile of flat panes of glass, on top of one another, with their entries and exists at different/varying angles (and presumably an opaque sheet of something between each layer). I can create a schematic of this if somebody is interrested and/or my description is not clear enough. It would also be very easy to make this very precise, by having two (or more) holes in each pane/plate/prism, and have a "pin" go through all of the holes in the stack for each series/stack of holes, thus ensuring perfect alignment of the prisms.
This way, you would get on your sensor, a series of spectrum lines on top of one another, giving you a 2D array of spectral points instead of a line/1D array of such.

I hope I'm not saying anything too stupid...

Maybe it's not stupid: I found an image that looks like that idea: https://www.osapublishing.org/getImage.cfm?img=dTcqLmxhcmdlLG9lLTI2LTE1LTE5NDU2LWcwMDE

The interresting thing/goal of what I describe here, would be that it would be very compact, which is the objective/what I created the issue for. But if anyone else has any idea of how to make things more compact, I would be very interested to hear about it (I need very compact spectrometers to identify materials on an automated recycling/sorting CNC machine)

Sorry for rambling about this, I hope I'm not disturbing anything, I'm just trying to get a conversation going.

Cheers!

3D Holder for Cheap Version / Resolution scaling

Hi Les, i cloned your nice spctrometer with the small and the big spectroscope. nearly no difference. i made a holder for the pi camera and the small spectrometer. It fits perfect for both, maybe you like to include this in your project:

https://www.tinkercad.com/things/fz8NYdaUxby

https://www.tinkercad.com/things/basXpPEWYCm

i like to build an closed case with battery driven pi, so i can also use it as portable version. i ordered a small 7" display with 1024*600 resolution. it will be nice to see an full screen version. i played a little bit with the code, but i´m not a programmer. i get the main frame and other frames bigger, but not the maingraph. maybe you can help me.

thanks a lot

Absorban reading ?

Sorry for opening issue here, I just want to know if I can read absorption through solution using your PySpectrometer?

Newbie with problems running PySpectrometer

Hello. I've just found your youtube channel Les. So many interesting videos. Inspired by your posts I've decided to try my hand at creating a Supercontinuum light source that you posted. I was going to buy a spectrometer but then noticed you have designed one using a Pi (but of course you have). I unfortunately am having trouble running the code. I'm somewhat a newbie on the Pi, so perhaps you might be able to see more easily what's wrong.

Here's my setup:
Raspberry Pi 4 running: Debian GNU/Linux 12 (bookworm).
Camera: Raspberry Pi HQ camera V1.0 - (I can run libcamera-hello with no issues except a warning about SDN tuning)
Display: PC Display: 4K display set to 2560 x 1440

Here are my traceback errors:
Traceback (most recent call last):
File "/home/rosst2019/PySpectrometer2/src/./PySpectrometer2-Picam2-v1.0.py", line 261, in
intensity = savitzky_golay(intensity,17,savpoly)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/rosst2019/PySpectrometer2/src/specFunctions.py", line 127, in savitzky_golay
window_size = np.abs(np.int(window_size))
^^^^^^
File "/usr/lib/python3/dist-packages/numpy/init.py", line 305, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module 'numpy' has no attribute 'int'.

---------------------Here's my command line info if you need to see it.
rosst2019@raspberrypi:~/PySpectrometer2/src $ ./PySpectrometer2-Picam2-v1.0.py
[0:21:10.854209711] [3123] INFO Camera camera_manager.cpp:284 libcamera v0.1.0+118-563cd78e
[0:21:10.901066323] [3129] WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:21:10.903741029] [3129] INFO RPI vc4.cpp:444 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media2
[0:21:10.903831676] [3129] INFO RPI pipeline_base.cpp:1142 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[0:21:10.910147872] [3123] INFO Camera camera_manager.cpp:284 libcamera v0.1.0+118-563cd78e
[0:21:10.954305816] [3132] WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:21:10.956771543] [3132] INFO RPI vc4.cpp:444 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media2
[0:21:10.956853894] [3132] INFO RPI pipeline_base.cpp:1142 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[0:21:10.963521455] [3123] INFO Camera camera.cpp:1183 configuring streams: (0) 800x600-RGB888 (1) 2028x1520-SBGGR12_CSI2P
[0:21:10.964081226] [3132] INFO RPI vc4.cpp:608 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1520-SBGGR12_1X12 - Selected unicam format: 2028x1520-pBCC
Loading calibration data...
Loading of Calibration data failed (missing caldata.txt or corrupted data!
Loading placeholder data...
You MUST perform a Calibration to use this software!

Calculating second order polynomial...
2
3.125e-05 x + 0.4375 x + 380
Generating Wavelength Data!

Done! Note that calibration with only 3 wavelengths will not be accurate!
Traceback (most recent call last):
File "/home/rosst2019/PySpectrometer2/src/./PySpectrometer2-Picam2-v1.0.py", line 261, in
intensity = savitzky_golay(intensity,17,savpoly)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/rosst2019/PySpectrometer2/src/specFunctions.py", line 127, in savitzky_golay
window_size = np.abs(np.int(window_size))
^^^^^^
File "/usr/lib/python3/dist-packages/numpy/init.py", line 305, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module 'numpy' has no attribute 'int'.
np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'inf'?

question about spectroscope holder

Where did you buy the black piece that holds the spectroscope (its rectangular with a hole the right size for the spectroscope and with what looks like a brass screw for holding it in place)? It doesn't show it listed in the parts on the github page.

dependency PIL.ImageTk missing

I start with fresh image "Raspberry Pi Os with Desktop" (from 2021-03-04) and got:

pi@raspberrypi:~/PySpectrometer/src $ python3 pyspectrometer-v3.py
Traceback (most recent call last):
  File "pyspectrometer-v3.py", line 46, in <module>
    import PIL.Image, PIL.ImageTk
ModuleNotFoundError: No module named 'PIL.ImageTk'

It seems, that one dependency is missing - I had to add:
sudo apt-get install python3-pil.imagetk

UV. / IR

Hi. how far into the UV and IR does the raspberry PI camera go? If any?

[Feature Request] for Raspberry Pi Camera Module 3

https://thepihut.com/products/raspberry-pi-camera-module-3

  1. Compatibility with Autofocus and HDR:
    The new Raspberry Pi Camera Module 3 features autofocus and a High Dynamic Range (HDR) mode. Incorporating support for these features in PySpectrometer would allow users to achieve better focus stability and image quality, which are critical for precise spectrometry measurements.

  2. Integration with the Picamera2 Library:
    The Camera Module 3 utilizes the new Picamera2 library. Updating PySpectrometer to fully integrate with Picamera2 would ensure compatibility and leverage the latest enhancements in the camera software stack, providing users with a smoother and more reliable experience.

  3. Enhanced Spectral Sensitivity:
    If possible, optimizing PySpectrometer to make use of any extended spectral sensitivity provided by the Camera Module 3 (particularly in the near-infrared and ultraviolet ranges) would significantly broaden the range of applications for the spectrometer. This could involve software adjustments to better handle and calibrate data from these additional wavelengths.

  4. Focus Lock Feature:
    For spectrometry applications, maintaining a consistent focus is crucial. Adding a feature in PySpectrometer that allows users to lock the focus once it has been adjusted using the Camera Module 3’s autofocus capabilities would ensure consistent data capture.

  5. Calibration Assistance:
    Including enhanced calibration routines within PySpectrometer that take advantage of the Camera Module 3’s improved resolution and sensitivity could help users achieve more accurate wavelength measurements. This could involve automated calibration steps or guided procedures within the software.

  6. Synchronization Capabilities:
    Given the Camera Module 3's potential for enhanced connectivity, adding features to PySpectrometer that allow for better synchronization with external devices (such as light sources or additional sensors) would improve the versatility and precision of spectrometric experiments.

Conclusion:
These enhancements would make the PySpectrometer software more robust and capable when paired with the Raspberry Pi Camera Module 3. The improved resolution, autofocus, HDR, and enhanced spectral sensitivity of the new camera module present an excellent opportunity to take PySpectrometer to the next level.

Thank you for considering these suggestions. I believe these updates would significantly benefit the user community and enhance the capabilities of the PySpectrometer project.

2021-01-11-raspios-buster-armhf too old for Rpi 4

I just bought the Rpi 4 for wonderful pyspectrometer project.

Unfortunately my Rpi4 cannot boot itself with recommended 2021-01-11-raspios-buster-armhf.
The Legacy and 2021-03-04-raspios-buster does not allow to install scipy.
The computer gets unrensponsive so I have to make a hard reset.

Any help would be very appreciated!

Regards
Andrzej

Screenshot 3

Gstreamer pluggin missing.

Hi,

I'm trying to run a video on a kv260.

I follow this tutorial (https://xilinx.github.io/kria-apps-docs/creating_applications/2022.1/build/html/docs/kria_vitis_acceleration_flow/petalinux-firmware.html) and I flash this petalinux (2022.1) with the configuration of the tutorial on the sd-card.

I saw that ffmpeg was not enabled so I follow the command below in this link (https://docs.amd.com/r/2022.1-English/ug1144-petalinux-tools-reference-guide/Adding-an-Existing-Recipe-into-the-Root-File-System) because I'm working with video -file.

After

-) petalinux -config -c rootfs where I enabled it

-) petalinux-build --sdk

-) ./sdk.sh

-) petalinux-package --wic --bootfiles "ramdisk.cpio.gz.u-boot boot.scr Image system.dtb"

Actually I run a c++ code created with Vitis 2022.2 where I print the build information with the function getBuildInformation() but I continue seeing this

Video I/O:

GStreamer: YES (1.18.5)

v4l/v4l2: YES (linux/videodev2.h)

gPhoto2: YES

without ffmpeg.

I also see this two warnings related to gstreamer that I don't understand how resolve.

[ WARN:0] global /usr/src/debug/opencv/4.5.2-r0/git/modules/videoio/src/cap_gstreamer.cpp (854) open OpenCV | GStreamer warning: Error opening bin: unexpected reference "video" - ignoring

[ WARN:0] global /usr/src/debug/opencv/4.5.2-r0/git/modules/videoio/src/cap_gstreamer.cpp (597) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

Unable to open file!

Could someone tell me what I'm doing wrong please?

Thanks in advance !

Cheap Spectrometer version

Any suggestion if it is possible to use some cheaper version of Diffraction Spectroscope? Here are few samples
https://www.amazon.com/Handheld-Durable-Small-Diffraction-Spectroscope/dp/B00MNEAMF4
https://www.amazon.com/Gain-Express-Diffraction-Spectroscope-Identification/dp/B017VM4Q86

The only obvious issue - there are no details regarding diffraction grating of lines/mm.
Aliexpress price for them are around $25 - https://www.aliexpress.com/item/32625200308.html

Instead of RPI + camera it should be possible to use $5 USB webcam and attach it directly to PC https://www.aliexpress.com/item/1005001465072245.html
Another $5 USD for the lens with zoom https://www.aliexpress.com/item/4000617323132.html

I am looking for some cheap spectrometer version and initially found webcam + dvd piece + wood box version https://www.youtube.com/watch?v=MgogwcXUIoc&t=131s
I really like PySpectrometer since it looks great. Now I am trying to make a really cheap version but with reasonable quality.

np.int deprecated in bookworm

np.int is deprecated in bookworm. we need to use np.int32.

127,128c127,128
< window_size = np.abs(np.int32(window_size))
< order = np.abs(np.int32(order))
---
> window_size = np.abs(np.int(window_size))
> order = np.abs(np.int(order))

Feature request: long time exposure

Dear Les,

this is a great project. Thank you for sharing! I found it via hackaday.

I am thinking about if I could use it for astronomy. Because the light sources (stars) are very dim, a long time exposure would be needed. Is there an advantage if the HQ Pi Cam is used instead of the Standard Pi cam for this case?

I just leave my thought for a long time exposure here for discussion. I more people are interested, maybe someone could implement it. Otherwise just close this ticket.

Keep up the great work :)

laser induced breakdown spectroscopy

Could you use this rig to do a demo of LIBS like the instruments on the Mars rovers? Are there low cost lasers capable of forming the plasma? I'm not sure if you can do any useful identification without the ultraviolet spectrum. This demo would be done in the context of high school physics.

It does appear to be possible to do UV imaging using the PI Cam.
https://www.mdpi.com/1424-8220/16/10/1649/pdf

Averaging to remove sensor noise

I suggest adding some sort of averaging from several frames, so that sensor noise doesn't get captured as legitimate spectrum data. Ideally, user should be able to toggle this function on/off as necessary.

I have not looked at the code too much yet, only at a glance. Besides python is not my number one language, but I am willing to help you add something that does the averaging.

Also, if you accept it, I saw some room for improvement with the code.

Me: US based software engineer by trade.

ps: averaging can be done by grabbing data from several rows above and below the "main scan line", instead of waiting for several frames to accumulate.

Project can't be cloned on Windows

This project currently can't be cloned onto a Windows machine due to the colons in the filename of this image:
media/spectrum-09-04-2021-15:19:27.jpg

Renaming the file to something like spectrum-09-04-2021-15-19-27.jpg will solve this issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.