Menu

Tuesday, October 15, 2013

[EmguCV] วิธีการเข้าถึงพิกเซลของภาพ
[EmguCV] How to Access Pixels of Image

สมมติให้
Suppose that
  1. Image<Bgr,byte> img = new Image<Bgr,byte>();

มีสองวิธีสำหรับการเข้าถึงพิกเซลตำแหน่งแถวที่ y และหลักที่ x ของ img
There are two ways to access the pixel on the y-th row and x-th column of img

Monday, October 14, 2013

[EmguCV] ทำไมขนาดข้อมูลของภาพแตกต่างจากขนาดของภาพ
[EmguCV] Why Image Data Size is different from Image Size

สมมติให้
Suppose that
  1. Image<Bgr,byte> img = new Image<Bgr,byte>(73,100);

ค่าของ img.Cols และ img.Width จะเป็น 73 แต่ค่าของ img.Data.GetLength(1) จะเป็น 76.
The value of img.Cols and img.Width are 73 but the value of img.Data.GetLength(1) is 76.

อย่างไรก็ตาม ค่าของ img.Rows, img.Height, และ img.Data.GetLength(0) จะมีค่าเท่ากัน คือ 100
However, the value of  img.Rows, img.Height, and img.Data.GetLength(0) are the same which are 100

สาเหตุนี้เป็นเพราะ EmguCV ต้องการจัดเรียงแต่ละแถวของภาพให้มีขนาดเป็นจำนวนเท่าของ 4 ไบต์เพื่อเพิ่มประสิทธิภาพในการดึงข้อมูล
This is because EmguCV requires each row of image to be aligned by 4 bytes to improve efficiency in fetching data.

Wednesday, October 9, 2013

[EmguCV] การแปลงภาพแบบ Perspective
[EmguCV] Perspective Transformation

การแปลงภาพแบบ Perspective คือ การฉายจุดลงบนฉากรับภาพตามแนวเส้นที่พุ่งออกมาจากจุดจุดหนึ่งที่เรียกว่า จุดศูนย์กลางการฉาย
Perspective transformation is the projection of points onto the image plane along lines that emanate from a single point, called the center of projection.

ขั้นแรก โหลดภาพตั้งต้นเข้าตัวแปร img
First, load a source image to img 
  1. Image<Bgr, byte> img = new Image<Bgr, byte>(image_path);
Source image

Tuesday, October 8, 2013

[HTML] วิธีการเปลี่ยน In-page Style Tag เป็น Inline Style Attribute
[HTML] How to Change In-page Style Tags to Inline Style Attribute

เนื่องจากบางอีเมลล์ไคลเอนต์ เช่น gmail ไม่สนับสนุน in-page style tags (<style></style>) เทมเพลต HTML สำหรับอีเมลล์ จึงต้องเปลี่ยนเป็น inline style attribute (<a style=""></a>)
Due to some email client, such as gmail, does not support in-page style tags (<style></style>), the HTML template for email must be changed to inline style attribute (<a style=""></a>)

เทมเพลต HTML สามารถเปลี่ยนได้ที่ http://beaker.mailchimp.com/inline-css
HTML template can be changed at http://beaker.mailchimp.com/inline-css

[EmguCV] วิธีการสร้างภาพพื้นหลังจากชุดของภาพ
[EmguCV] How to Create Background Image from a series of images

ในกรณีนี้ กล้องถ่ายภาพจำเป็นต้องถูกยึดอยู่กับที่
In this case, a camera must be stationary. 

นั่นหมายความว่า ภาพพื้นหลังจะเหมือนกันทุกภาพ ในขณะที่วัตถุจะมีการปรากฏขึ้นเพียงบางภาพเท่านั้น
That mean background are the same for each image while objects (foreground) will appear in only few images. 

ดังนั้น ภาพพื้นหลังสามารถสร้างได้ โดยการเฉลี่ยชุดของภาพ
Therefore, background can be created by averaging a series of images.