Skip to main content.
January 4th, 2006

Quick update about DSharingu

dsharingu/dsharingu_06_01_04.png
It’s past 5 AM. Today I dedicated quite a bit of time to DSharingu (still old release). I finally got some interaction going. The screenshot shows the view that I have of the home server on the PC in my bedroom. I launched Firefox remotely and browsed around.
It took me some time to get to the right function.. SendInput(). Once I found out about it, it wasn’t too hard to use it. However there is still a problem: when interacting with the remote DSharingu window, the remote instance locks !
I think that it’s probably due to the fact that the main loop receives input event remote messages synchronously. So, I tried to relocate the network message input system from the synchronous main loop, into a separate thread. That should solve it, but I’m still not done. I really want to use multi-thread only for those messages that need it, the simulated input messages.
Compression needs more work. I have some interesting ideas, but right now, I want to focus on basic features… optimizations can wait.

I also modified my windowing system. I no longer simulate sub-windows (like the translucent shell frame form the previous version). Every sub-window is now an actual Windows’ child window. This saves me a lot of work… I like to do some basic wrapping, but it’s too easy to fall into the trap of wanting to write a whole sub-OS. Right now, I just need to get things done !

Thanks to my friends in Italy (Jag and Rasty !), my family is getting back to wireless Internet use. Now, more than ever, I need this remote administration thing. Once all features are up (no self-locking and keyboard input), and once things are optimized for the right bandwidth, I should be able to remotely show and fix things !

The program as it is now, will allow me to accept connections, because I have full access to network ports at home.. however, this may not work in the office, where I’ll be firewalled like my parents are.. both can call out, but neither can accept a call 8(
For cases like that one, I plan (hopefully with some help !) to convert DSharingu to work as a Skype plug-in. Skype is very flexible, making it easy to transfer data without having to worry about firewalls.

We’ll see !
zzzzzzzzzzzzzzzzz

Posted by Davide Pasca as Image-processing, Programming at 5:44 AM EST

11 Comments »

December 26th, 2005

Quick Christmas report (code code code)

I spent the whole day at home, coding ! Actually coding and preparing stuff for a release. That included working with the installer and looking into Wordpress features to make pages for static content. Basically a page for a project, separated from the blogs posts such as this one.
With those changes came also a change to the site URLs. Gone is the /?page_id=111. In it’s place there are now friendly names.
What I’m trying to release is dsharingu. The page is up, the software can’t be downloaded yet !!! It would probably be already up for download if I didn’t need to spend those extra hours to document things etc etc… but a software by itself doesn’t have much use.
Yesterday night, after a small Christmas dinner, I also worked on yet another compression scheme do be used for DSharingu. I basically put aside the HSV concept for a future better use (video-chat) and went for a simpler and faster system. The new scheme is inspired by systems such as ST3C. Also somewhat similar to BTC (Block Truncation Coding). But really, all compression schemes start to look alike after a while !
Anyhow. The basic compression is pretty much decided for the time being. Before the release however I want to modify the protocol a bit.. actually putting in place a minimal system that has a concept of protocol revision, to avoid weird crashes between different releases of the same program.

I want to hurry up, but I also have a lot to do. Tomorrow I’ll continue. I hope that in a few days I can finally release something… if anything, just to release it and see how it goes from there !

We zzzzzzzzzzz
poof

Posted by Davide Pasca as Image-processing, Programming, Diary at 2:01 AM EST

1 Comment »

December 13th, 2005

Back to work, back on the scale and HSV color-space

Today I went back to work ! There is already something to fix, but luckily, not a terrible pressure.
I also went to the gym after having missed it a few times recently, as I was enjoying my vacation. I now weight 70.75, which is 5 grams more than where I’m supposed to be in 3 days …but I didn’t go to the bathroom for the day !
Not having had to go to work helped to lose weight. I was so busy with other things, and because I had no schedule, I wasn’t compelled to have a damn whole lunch every day while having plenty of time to sleep. Indeed (for what is worth it) I recently read from ansa.it that some research says that lack of sleep and weight gain go together.

The other day I tried to improve the compression for dsharingu. As usual, sub-sampling the chromatic components spatially (one pixel every 4). However that turned out like a complete mess. ClearType & co. is a problem, as expected. It’s like noise that needs to be filtered out, or will turn nasty when compressing. Also my naive YC format didn’t really scale well with spatial sub-sampling.
I eventually turned to HSV (Hue Saturation Value), which is another name for HSI (Hue Saturation Intensity), but which was originally called HWB (Hue Whiteness Brightness).
I actually wasted a lot of time trying to find out more about HWB, before realizing that was nothing but HSV !
One problem with this HSV (or whatever one calls it), is that it’s not explained in a very intuitive way. Or perhaps I’m just dumb ! Anyway, I eventually figured out the magic about it:
For RGB->HSV, find the maximum and minimum of the given R, G and B, values. Use the maximum value for V. Saturation and a third value (that I call T here) are coefficients to use to find the other two values. If, for example V is for R, then S and T are used to find G and B.

When going from TSV->RGB, if R was the max, it could be:
R = V
G = V * (1 - S * T)
B = V * (1 - S * (1 - T))

This is what I called TSV and it’s not very useful because it still needs some information to specify which value was the max and which was the min ! If for example, G was the max, then:

G = V
B = V * (1 - S * T)
R = V * (1 - S * (1 - T))

This information needs to be stored. Let’s say in a variable called P (as permutation or palette). Every value of P corresponds to a combination: RGB, GBR, BGR, … there are 6 of them. All possible combinations of 3 values are 3! (3 * 2 * 1).
Now we have a new, complete, color format called PTSV. This is pretty much HSV. In fact, P and T can also be unified in one variable:

(H,S,V) = ((P+T),S,V)

This works because T = [0,1) (or, from 0 to 0.999999~) and P = { 0, 1, 2, 3, 4, 5 }

Thus, the integer part of H tells me the permutation and the fractional part is T.

P = trunc( H )
T = H - trunc( H )

if H = 4.51, then
P = 4
T = 4.51 - 4 = 0.51

..it’s a bit messy. I prefer to think in terms of PTSV.

I must say that, to be accurate, the actual H should be an angle, therefore T should be interpolated angularly and not linearly !
However, speed is one of my major goals. Also, if one really wants to get fancy, it would probably be more elegant to throw in the complex plane to describe the color format. Not sure if it has been done, but I’m clearly no the one that will try do that.. at least for the time being !

zzzzzzzzzz !!!!!!!

Edit: Sad !!! I shouldn’t have rushed to explain something I don’t really know..
I meant to come up just with the P and T separation thing, but I went to explain a little too much, into the realm of bullshit.
Actually, with the previous explanation, it was easier to understand the concept of storing a main component and two coefficients, but that was a bit too fictional when compared to the actual HSV.
Should be better now !

Posted by Davide Pasca as Image-processing, Diary at 2:31 AM EST

6 Comments »

December 8th, 2005

Printers, errands and coding

Today I went to Akihabara to buy a printer. Last time I bought one was a long long time ago. I was in Italy and my father bought it for me. In fact, I must have been 16 or so ! It was a Commodore 803, or something like that.
Now, I need to renew my passport, and I really hate the idea of taking one of those lame instant photo-booth pictures. So… yesterday I spent quite a bit of time trying to take a decent shot of my face, and today, I bought a printer.
Anyhow, since there doesn’t seem any decent PDA out there (to me a PDA should be more like a notebook and less like a fat media-center), I think that a printer will be useful for those times in which I want to print some PDF at home, or even a quick map to carry around when going someplace.

Tomorrow I’d like to go to the Italian embassy to renew the passport, but the embassy’s site appears to be down.. so, I have no idea of where this damned embassy is located.
Why is the site down anyway ? Someone must be on strike. In Italy there is always some strike going on. But in this case we are talking about technology (the web.. woohooo !!), so it’s obvious that there is also some other incompetence involved. After all, last time I saw the site, it surely didn’t seem like something very refined (to put it mildly).

About coding.. I’ve been trying to push forward the latest version of RemoteDest, actually now called DSharingu (like the Japanese flavored name ? 8). It’s a complete rewrite. It has come slowly, but it includes a lot of recent stuff that I’ve been doing left and right.. some application-building base code.
My main push in all this is the fact that I want to remotely admin the PCs of my family in Rome, but the provider they use, blocks all ports in input (again, great country and all). That rules out VNC, because it’s based on a server & client architecture by which who shares the PC needs to be able to accept incoming calls on a certain port. In my case, I’m making it possible for my parents to call me and share the display of their PC at the same time.
Another thing that pushes me is, of course, pride ! I’ve been working around this stuff before VNC came out (I think)… I do have something in my hands, it would be lame if I had to give up to some other software.

Speaking of VNC. I did a quick research, and it seems that its compression scheme is not very sophisticated. Apparently it now uses the ZLib and one can choose the compression level based on the ZLib compression level. If VNC’s compression scheme setting relies on the parameter of ZLib, then it means that it’s not that sophisticated.
For example, JPEG images also have a last step of entropy compression. JPEG uses Huffman encoding there, but that really is last step, while the bulk of the compression is somewhere else (transformation to frequency domain and quantization).
I think that there is a lot of room to improve image compression of a GUI display. Many clever things could be done.. and also one should normally deal with lossy compression, because speed is really the main factor when it comes to administer a remote computer.

Currently I’m applying transforming RGB to a luminance + chrominance system, that I simply call YC. It’s simpler than YCrCb, definitely similar to HSL which I’ve been playing with in the past.
One problem with working with RGB with modern displays, is that things such as CoolType and ClearType, juggle around with R, G and B a lot, making it hard to compress them individually.

For the time being I’m posting a screen-shot, although tonight I already successfully set-up a simple installation process using NSIS (great stuff).

dsharingu/dsharingu_05_12_08.png

And.. 5AM… maybe better go on with a morning of errands and go to sleep in the afternoon !

Posted by Davide Pasca as Image-processing, Programming, Diary at 5:19 AM EST

No Comments »

June 30th, 2005

Quantization in HSV color-space

The past two nights I’ve been toying around with Matlab, making experiments with color spaces. Specifically, I worked on the idea of completely separating luminance from chrominance.
I did a few experiments, but the one that I want to report about is with HSV. HSV color model separates hue, saturation and value (or luminance/intensity). There are actually three similar but different models: HSV, HSL and HSI, but for my purpose, that doesn’t make much difference.
The experiment is about removing information on any of the three channels, to see which one is the most important, and how I can reduce the information while minimizing the visible artifacts.
I proceeded to created three different images, each leaving 2 channels intact, and one strongly quantized. For the intact channels, I kept the original 256 levels. While the quantized one was reduced to 8 levels.

Here is the original image:

Here a are the resulting images:

On the first row, there is the hue component, hue component with only 8 levels and then the image built using the quantized hue.
The second row expresses the same process, only this time quantizing the saturation.
On the third row the value (gray levels) is being quantized.

As expected, messing with the hue can be pretty messy. The color sensibly shifts and what’s green becomes brow !
The gray-level image is also visibly affected by quantization. It’s probably the worst of the three, but that doesn’t worry me, because it’s supposed to be compressed the JPEG way (quantization on DCT transformed data, in frequency domain).
Quantization on saturation is really not that much of a big deal, and that’s also what I was expecting.

So, now the real issue is with hue. The quantization clearly has some drastic effects. Using DCT would lead to some serious artifacts, as the ringing artifacts would bring, for example, cyan and yellow pixels around an original green one. Or perhaps I’m worrying too much. However, there would still need to be some special preprocessing, because hue values have a discontinuity on red. 255 and 0 are both very close to red. The lossy DCT would make a mess between 0 and 255 because it’s a drastic change.

Also it has to be noted that the quantization performed here was rather dumb, because I’m not selecting the most 8 used values, but I’m blindly rounding original values to 8 fixed ones (on a 256 scale that’s 256/8 = 32, selected values are 0, 32-1, 64-1, .., 256-1).
Using an actual palette of used values would ensure that no brown comes up where green should be. The green value would come into the palette as the most used one, instead of being snapped to a fixed value.

Next, I should probably try to properly quantize the hue, building a palette of used values. Possibly building separate palettes for separate areas of the image.

mumble

Posted by Davide Pasca as Image-processing at 1:43 AM EDT

3 Comments »

April 29th, 2005

Trying to get the best off cheap CMOS web-cams and expensive robo-dogs

Tonight I finally tried to put in practice some thoughts about the dreaded CMOS cameras static noise.The need came from the poor quality of Aibo’s camera. However, for the time being, I’m using a relatively cheap USB camera. With this camera, much like in Aibo’s case, the temporal noise reduction doesn’t maximize the quality of a single image. So, I finally tried to write some code to try locate the static noise.To make things easier, I decided to sample the noise in complete darkness (..with a finger covering the objective 8). This does not give complete darkness, however. There is of course the noise that I want to detect, plus the camera driver fiddling with white balance.. adding artificial brightness to the image.
At the current stage, my algorithm is very simple: I take the average color of all pixels in the image and subtract it from the reference “dark” frame. The one captured with my thumb covering the camera 8P. This goes for red, green and blue components. The result is an RGB image comprised of values that need to be subtracted from the subsequent frames.. those that I want to correct by removing the static noise.
Actually, I added slightly more complexity by subdividing the image in a grid of 32×32 pixel squares and calculating color averages by those squares rather than globally for the whole image. But I’m not sure that that’s helping much.This is a very simple approach. In fact, a simple subtraction isn’t the best solution. To suppress the noise, it’s very likely that I’ll need to scale values (multiplication/division), rather than offset them (addition/subtraction). Or possibly scale and offset at the same time..
In any case, I think that the early experiments are very promising ! I’m actually pretty excited about the results.

Here are a couple of examples, please keep in mind that the image quality is not meant to be good. I kept the environment relatively dark on purpose, to strengthen the noise effect and the countering effect of the algorithm.


A mousepad…

As it came from the driver.

With temporal NR and dark-frame subtraction.



A sleepy programmer !

As it came from the driver.

With temporal NR and dark-frame subtraction.

(Gone is the rGbRgBRGbeard 8)

..hopefully, my Aibo’s sight will soon improve too !zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

Posted by Davide Pasca as Image-processing at 5:59 AM EDT

15 Comments »