Posts

Showing posts from August, 2018

An Architecture for a hardware-software system

Image
You are to design a single camera software, various client applications, and a communication model for a family of cameras. Each camera runs the Android OS, and will be crafted to make several variants; each of which takes up different forms. Each camera has various channels and interfaces to communicate with. Variables in the camera variants: headless or on-device display ie, the camera may be wireless only; it may have an LED as an indicator, or it may have an OLED or LCD perform on-device analytics not each camera is allowed to perform on-board analytics; some could do stabilization, some face detection, some motion detection, some may perform all. This is limited by what algorithms the customer buys. camera sensor resolution, fps, camera lens every variant has a different sensor and lens specification multiple camera sensors some cameras might have multiple sensors; thermal, near IR, or visible light motor-driven PTZ the camera might have a pan-tilt-zoo...

Lessons from drumming classes

Image
Now, my drums teacher is quite a strict man. He's been teaching for over 10 years and has performed all over the country for another 10 years prior to that. Not everyone approves of his way of teaching, and he ensures he admits only those students fine with his strict ways. I've been attending two-hour classes once every Thursday, for the past 4 months now, and he has not yet let me play simple quarter note exercises. Most drum classes teach this during the first couple of weeks; some even start with these on their first day. He, on the other hand, has forced me to learn how to read notes, practice every exercise from the slowest 60 beats per minute to 240 beats per minute, and engraved in my mind that a great drummer is not one that can play a jazzy riff or perform a fancy dynamic, but one that understands drumming is all about timekeeping. Here's a list of parallels I've drawn from my life outside of drums. I ignored understanding Fourier transforms in my 1st yea...

False coloring a video in real time using lookup tables

Image
I've been working on OpenGLES very intensively for video rendering and applying real-time filters for months, and I haven't yet put up a blogpost on one of my favorite filters yet. I love it because it shows how fast and simple things can be in the GPU if you know how to use it well; What you have to do is given a greyscale image, false color it with a provided mapping from grayscale to RGB values; i.e., Grey [0,255] --> R [0,255], G [0,255], B [0,255] In a traditional CPU world, this is fairly simple. All you have to do is loop the image for each pixel, and use the mapping to convert the grey pixel to an RGB. But this is insanely slow, and cannot be done in real time. In comes the GPU! It's perfect for repetitive tasks, like this simple image processing problem where you have to apply the same function to every pixel of an image. Here's what the output looks like. The center image is the original greyscale image. My favorite color palette is the one o...

Fully Duplex Multi Client Socket Communication

Image
I’ve written a small, complete and reliable socket communication library. I wanted to avoid using the nio package and use the default ServerSocket and Socket classes provided in the java.net package. Fully Duplex; Async This means the server and client can asynchronously send messages to each other whenever they’d like. This is different than most libraries where the server is only listening for messages and responds when a client requests for some information. Multi-Client The server can host as many clients as the internal sockets implementation allows. Java’s ServerSocket implementation sets the size to 50 connections . The server can also restrict the number of simultaneous clients it’d like to host at once. Any client can send a message to any other client. Server-Client symmetric API Effectively, it really doesn’t matter who the server is; each device in the network gets a callback when a device connects or disconnects, and each client is assigned IDs by the ser...