Logbook noting:
Now take a quick glance through the code. You’ll notice
ViewController.m uses UIImagePickerController to pick images
from the album or to take pictures with the camera.
Now, a section-by-section recap:
1. Section
1: Convert the UIImage to a CGImage object,
which is needed for the Core Graphics calls. Also, get the image’s width and
height.
2. Section
2: For the 32-bit RGBA color space you’re working in, you hardcode the
parameters bytesPerPixeland bitsPerComponent,
then calculate bytesPerRow of the image. Finally,
you allocate an array pixels to store the pixel data.
3. Section
3: Create an RGB CGColorSpace and a CGBitmapContext,
passing in the pixels pointer as the buffer to store the pixel data this
context holds. You’ll explore Core Graphics in
more depth in a section below.
4. Section
4: Draw the input image into the context. This populates pixels with
the pixel data of image in the format you specified when creating context.
5. Section
5: Cleanup colorSpace and context.
this link is about pixel, RGB, hue
next key word: UIImage
The
UIImagePickerController class manages customizable, system-supplied
user interfaces for taking pictures and movies on supported devices, and for
choosing saved images and movies for use in your app. An image picker
controller manages user interactions and delivers the results of those
interactions to a delegate object.
The role and appearance of an image picker controller depend on
the source
type you
assign to it before you present it.
·
A
sourceType of UIImagePickerControllerSourceTypeCamera provides a user interface for taking a new
picture or movie (on devices that support media capture).
Comments:
From
this point, I began to focus on programming affairs. As for image processing,
it was not the first time I met with it, in my year two project, I had already
got in touch with it. In year two, our group used Matlab mainly (click me to see more information about my Year Two group project). However I had to
develop this app using OC.
I
have to think about how to take photo first. I watched some videos on how to
open a camera and take a photo. Here I want to recommend some useful videos on
Youtube.
1.
In this video, the
author introduces how to build an application which can open camera and take
photo.
2.
In the second video,
the author provides a very good example of how to display a preview and take
photo. That preview is just like a life video and this is very helpful to my
project. After some modifications, it can take several photo only with one
click
Also,
there was a website which helped me a lot during my developing process:
In
this web, you can find answers to almost every question you have during the
developing process.
As for
representing colours, I chose RGB rather than HSV. Because I think RGB is more
basic and easy to get from a picture using Objective-C.
No comments:
Post a Comment