Skip to content

Xylla otoscope works partially #4

Description

@mem0c

Hello,

thank you for sharing this. I was able to adapt the code for my device (Xylla otoscope) with partial success.
For this device the ip and ports are different.

Capture from device:

DEVICE_HOST = '192.168.0.10'
DEVICE_CMD_PORT = 50000
DEVICE_STREAM_PORT = 8032

with open('raw0.bin', 'wb') as file:
    data = b'\x99\x99\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
    stream_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    stream_sock.sendto(data, (DEVICE_HOST, DEVICE_STREAM_PORT ))
    while True:
        data, _ = stream_sock.recvfrom(self.BUF_SIZE)
        file.write(data)

This seems to capture but stops after a while (the device either shutdowns or the camera led switches off).
I get a file which contains a sequence of [24 bytes header + bytes b'\xff\xd8' .. b'\xff\xd9 ( jpeg frame ?) + additional byte]

Post process:

with open('raw0.bin', 'rb') as f:
    data=f.read()

JPEG_START = b'\xff\xd8'
JPEG_END = b'\xff\xd9'

idx = 1
start = 0
while True:
    old_start = start
    start = data.find(JPEG_START, old_start)
    if start == -1:
        break
    
    end = data.find(JPEG_END, start + 2)
    if end == -1:
        break
    
    file_name = f'file{idx}.jpg'
    with open(file_name, 'wb') as f:
        jpg = data[start:end + 2]
        print(f'Wrote {file_name}. Frame has size {len(jpg)} from offset {start} to {end + 2}. Header={data[start-24:start]}')
        f.write(jpg)
    
    idx += 1
    start = end + 2

Example of jpeg written above:

Image

As you can see there are garbage in the image.
The captured file is here raw0.zip

Any help would be appreciated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions