Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Saturday, 29 August 2015

Where are the simple black and white camera apps? - Here's one now!

I could never see the point of black and white photos before. "You're just getting rid of colour, getting rid of precious data of a photo." As a person who barely ever deletes photos or videos, I didn't see the point in taking any photo not at the full quality. I always wanted as much detail preserved in my photos as possible. To illustrate this further, I always kept my Sony Xperia Z1's camera resolution at 20.7 megapixels, just so I would get as much detail out of the images as possible. I'm not a data waster. Recently, when I bought my Sony Ericsson Satio for the third time, I changed my mind. The Satio's camera is terrible when the sun isn't directly hitting the sensor. Otherwise it's great. When you point it at the slightest amount of darkness, chromatic noise creeps in like crazy. The Xperia Z1 mostly features just luminance noise, so it's colourless. This got me thinking, wouldn't images then turn out much better if I get rid of all colours? I'm thinking turning photos black and white of course. In these monochromatic images, the chromatic noise turns into luminance noise and it's much easier on the eyes.

As I tried black and white photography for a while, I really got hooked. I always thought it was overrated until I took it seriously. Being left with only a few shades of grey, shooting these monochromatic photos made me think more critically about the composition of the shot. I stopped worrying about image quality and noise, and I started to appreciate the art of photography. If you think it's boring, overrated, or any other negative adjective, I dare you to go out one day with only a black and white camera. Especially when you're 'out of ideas' or lacking inspiration for photography, this can be a great tool to get back in the game. Luckily for me, that recently bought Satio came with a setting for black and white photos.

Unluckily however, the Xperia Z1 did not. Well... there is this stock camera app called "Creative effects" from Sony that I have no idea of how it ever got through their testing phase. The preview is far from smooth, there is no way to change a single setting and worst of all, the effects take a lot of processing power and make the camera actually overheat and shut down within minutes. It's absolutely ridiculous. I realized this was going to be the moment for me to learn to build Android applications. At the time I was already taking a course in Java, so it was the perfect opportunity for me to put my experiences to the test. And now...

I present to you, Monochrome! 

Can you guess the city?

It took me a lot of work but it's here now: a fully feature-packed product. It has a clean interface, yet giving the possibility to change settings by swiping left and right, and up and down without being needlessly in your face. It integrates into Sony's own software, as that's the best way for quickly accessing the app from any camera mode. By default it's set to Auto Mode, which does what its name suggests and applies image stabilization where supported. If you swipe up or down, you can change the mode to Sports Mode and Night Mode. Sports mode is for those snaps that you need to take quickly. These kinds of photos aren't close ups, so I set the focus mode to infinity for this mode with a high base ISO so that the image is taken as quickly as possible after you press the shutter button. Night Mode (which by the way works just fine with the 20.7MP setting) when used in the dark, slows down the shutter speed as much as possible to get the most details out of the image as possible. Moreover, I chose to set this mode to enable the macro or close up focus mode. This focus mode is slower than autofocus so I decided to keep it out of Auto Mode to make capturing Auto Mode images quicker. Since the entire camera app is monochrome, white balance does not affect the photos and so Night Mode can be used and should even be used whenever you want the highest quality images when you can keep your phone steady. I use my app on Night Mode about 80% of the time. The other 20% is to make sure the other modes work properly [and yes, they do] ;)

If you want the full list of features and settings you can change, the app description in the Play Store is the most convenient: any updates will surely make its way to the description there. And trust me, I will update the app whenever there's a good feature idea. As a side note: like I always do with whatever I program, I added a little Easter Egg into the app. Can you find it?


If you'd like to buy me a cup of coffee and get a smooth black and white camera app in return, check out the app in the Google Play Store.

I would be very grateful; I will forever remember your name if you decide to leave that behind which may not be the best idea to do on the interwebz but no really thank you I need coffee

Monday, 6 April 2015

Project "Personal Pet" - An Artificial Arduino Animal

Ever since I heard I wasn't allowed to keep pets at my place, I've been dying to find a loophole to keep a pet anyway. Although I recently moved to a new place, the rules for keeping pets are the same: not allowed. Now, I could keep one anyway and not tell or let anyone know, but that's not like me. So what I decided to do - since I'm studying Artificial Intelligence anyway - is to make my very own pet, with blackjack and hooke- ah no wait that can't be right. I'll be making my own pet with an Arduino, completely from scratch!

The idea is to start off simple, with only an abstract program relying on input and output on a PC, so without any peripherals attached to the Arduino. Once I have the basics set up such as the pet's needs, I can continue to expand the Arduino with sensors, a display and perhaps wheels to replace feet. The most interesting part can only be programmed once the basics are set up: the intelligent behaviour. There are a few ideas that might be put to use, but for now I'm thinking about making the Arduino learn through genetic algorithms (GA). The interesting aspect of the animal is that it should learn how to "stay alive", which is a perfect condition to put the GA to use, to make somewhat unpredictable movements or perhaps sounds in order to live most efficiently. Ideally, I would let the pet run around with a battery and use wireless charging as "food" for the pet, so that it can sustain itself with plenty of charge left and not ruin the battery either.

I have to note that this concept is purely hypothetical so far. I'm going to purchase an Arduino soon and I'll see how far I get. I can only program in C as of now and I know nothing about the Arduino except that it is a standalone chip able to be programmed. All that's left for you, my dearest reader, is to find the perfect name for the pet's species. I've collected four names so far, as seen in the poll below, but I'm still looking for even better suggestions from you. If you've got anything in mind, just shout it out in the comments below. Any thoughts about the project are welcome too!


What should the Arduino pet's species be called?

Hoguino
Ardueen
Greenduino
Cappuccuino
Poll Maker

Tuesday, 9 September 2014

Receipt scanner

Ever since I started living on my own over than a year ago, I've wanted to somehow keep my income and expenditure digitally. I used to keep all receipts from groceries so that I could put this in a computer. But typing all relevant data from every single receipt by hand is waaaaay too much work. I did start an Excel document in the beginning, adding only the totals but this again was too much work. I had to open Excel to modify the document every single time I'd go to a store, which is very impractical. But as an Artificial Intelligence student, I knew I could do better. There had to be a way to scan a receipt and put the data directly into some kind of graph.

Don't stare directly at the noise - this image was taken with my recently re-repurchased Sony Ericsson Satio out of ease.

Now I've finally found a way to easily do the scanning part with my phone. It requires three applications: Tasker, Google Goggles and Dropsync (assuming you already have a Dropbox account). I had noticed Google Goggles can scan pieces of text and lets you copy the text to the device's clipboard. That's where the fun started. In case you're unfamiliar with Tasker, it basically allows you to program your phone to perform tasks whenever a user define state or event (profile) takes place. These profiles and tasks are fully customisable, enabling you to do essentially anything with your phone. From changing your phone's brightness when you're connected to your home Wi-Fi network, to reading the calendar events out loud for the day when you wake up in the morning - creativity is the limiting factor, not the application itself.

I set up Tasker to show a persistent notification as long as the Google Goggles application was running in the foreground. If you press the notification, Tasker performs a task where the contents of the clipboard are pasted in a new file, "receipts.xml" (I chose .xml instead of .txt as the latter didn't correctly show newlines). The last part of my 'scanner' makes sure the scanned receipt files are sent to my computers. For this I used Dropsync, which automatically detects changes to specified files to synchronize with Dropbox (Dropsync is basically the desktop synchronization version of Dropbox for phones, instead of the online non-synchronizing one from Dropbox themselves). What I get is a scanner where I open Google Goggles to take a picture of a receipt, copy it to the clipboard, press the notification which is only then present and magic makes the digital versions of the receipts appear in a Dropbox folder across all my devices!

Oh, how much I love Tasker...

This is only the start however. It's the start I needed for collecting data, sure enough important as physical receipts decade over very little time. But the most important part is always data manipulation. As people like to say, we live in an era where Big Data is a thing. There is much more data than we can use as of now, not because we don't want to, but because we don't have the resources to manipulate all of it. For me and my Little Data, I will soon start trying to program .xml data manipulation in C, if this is at all possible. Unfortunately, C is the only programming language I know and I cannot afford to learn a new language with my study being rather demanding. My goal for the receipts program is to manipulate the raw text to sort the receipts on their exact date and time, and to put the products and associated price tag in a statistically useful list. Here's where my current course, Statistics in R, comes in handy (yup, R is the second programming language I'll master, after I master C)!
(No I don't know why they use single letters for their languages, except that programmers are usually extremely f*cking lazy which might be the cause here)

Saturday, 5 July 2014

namegen.c

Yesterday I started programming a [sorta kinda] working Random Name Generator in C. Unfortunately I haven't found a way to make the code compile and run through my blog [I doubt it's even possible] so this blog post will just elaborate on the process of creating the horrible awfulness that I named "namegen.c" [if you're not at all into programming I recommend you stop reading now before your brains im- and/or explode - I will not be held responsible for anything that happens to your brain even if you are into programming].

DISCLAIMER: I suck at programming harder than your mom did last night.


So I started programming with the framework inside the main() function, obviously. I created some obvious global variables because I cannot program and then I started working on the "insertLetterV2" function, the most important part of the name generator. It's a second version because the first one only had "half-baked" rules that barely made it any more readable. And that exactly is the main problem of a name generator: a name must be created that is both random and still readable at the same time. I came up with an ingenious idea [if I may say so] myself - you can read about this after the break!