LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsActive stereo depth cameras give a distance for every pixel. With the Gemini 335 mounted looking straight down at a table, the box top is closer than the table, so the box stands out in the depth image. Height is table distance minus box-top distance; length and width come from the box's outline in pixels converted to centimetres with the camera's field of view. The script uses Orbbec's official Python SDK (pyorbbecsdk) and OpenCV on a PC or a Jetson.
Tick anything you already have and the total updates.
Orbbec Gemini 335 stereo depth camera with IMU
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB 3 from the computer.
box_measure.pyimport numpy as np, cv2, math
from pyorbbecsdk import Pipeline, Config, OBSensorType
HFOV, VFOV = 90.0, 65.0 # depth field of view from the camera's datasheet
pipe, cfg = Pipeline(), Config()
prof = pipe.get_stream_profile_list(OBSensorType.DEPTH_SENSOR).get_default_video_stream_profile()
cfg.enable_stream(prof); pipe.start(cfg)
def depth_mm():
while True:
f = pipe.wait_for_frames(200)
d = f.get_depth_frame() if f else None
if d:
a = np.frombuffer(d.get_data(), dtype=np.uint16).reshape(d.get_height(), d.get_width())
return a.astype(np.float32) * d.get_depth_scale()
empty = depth_mm() # run with an empty table
table = np.median(empty[empty > 0])
input("Place the box and press Enter")
d = np.median(np.stack([depth_mm() for _ in range(5)]), axis=0)
mask = ((d > 0) & (d < table - 15)).astype(np.uint8)
cnts, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
box = max(cnts, key=cv2.contourArea)
(cx, cy), (pw, ph), _ = cv2.minAreaRect(box)
top = np.median(d[mask > 0])
h, w = d.shape
mm_per_px_x = 2 * top * math.tan(math.radians(HFOV / 2)) / w
mm_per_px_y = 2 * top * math.tan(math.radians(VFOV / 2)) / h
print(f"L {pw * mm_per_px_x / 10:.1f} cm W {ph * mm_per_px_y / 10:.1f} cm H {(table - top) / 10:.1f} cm")
pipe.stop()
Use a USB 3 port and install the udev rules from the SDK on Linux.
Shiny or black boxes give holes in depth; average more frames or add light.
Check the depth field of view for your resolution in the datasheet.
About 1-2 % of distance with a well-lit matt box at 1 m.
On a slow conveyor, yes, if you grab frames when the box is centred.
Active stereo works in daylight better than many ToF cameras, but test in your conditions.
1 part: Orbbec Gemini 335 Active Stereo 3D Depth Camera w/ IMU. On this page you can tick the parts you already have and add only the rest to your cart.
It is a advanced project and takes about 1 day. The build on this page has 6 steps.
No. This page has the complete, tested code (box_measure.py).
About ₹37,459 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How active stereo depth cameras work; Segmenting an object by depth; Converting pixels to real size from distance and field of view.
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
See the smoke level live on a crisp screen and get a loud warning when it spikes.
An infrared eye that spots an open flame and raises the alarm.
Walk into the room and it sounds the alarm: the classic first security build.
Learning project. Check every circuit and the datasheet of each part before you power it up.