• About Me
  • My Slides

WindyGallery's Weblog

~ I am a normal man in quite imperfect little World.

WindyGallery's Weblog

Monthly Archives: March 2009

Photoshop:Power of Curve

31 Tuesday Mar 2009

Posted by windygallery in Photos

≈ 2 Comments

Tags

curve, photoshop

เคยเขียนเรื่องการแต่งรูปด้วย PS ไว้นานแล้ว
เอามาโพสเก็บไว้ เผื่อเป็นประโยชน์กับคนอื่นบ้าง

ออกตัวไว้ก่อนนะครับว่าไม่ได้เซียนอะไรอย่างใครเขา
แถมใช้เครื่องมือเป็นจริงๆก็ไม่กี่อย่าง
นอกนั้นก็มั่วๆแถเอามาตลอด
เน้นอุปกรณ์น้อยแต่ใช้งานเยอะเข้าว่า
มันก็จะคล่องและชินมือไปเอง

ดังนั้น ถ้าให้ผมเริ่มแนะนำ
เอาเบสิกๆ ที่ใช้งานได้จริงกันก่อนดีกว่านะครับ (^^”)>

ถ้าจะให้เลือกความสามารถซักอย่างใน Photoshop มาซักอัน
หนึ่งอาวุธสุดยอดสำหรับการแต่งรูปของผม
ผมคงยกให้ Curve เป็นอาวุธอันแรกที่ผมมักจะใช้ (always)

ความสามารถหลักๆของมันก็คือ การปรับสีโดยรวมของภาพ
จากที่ถ่ายมาได้รูปเน่าๆตุ่นๆ ให้กลายเป็นสีสันสดใสขึ้น
ได้ในพริบตา

(^^) ฟังดูดีใช่มั๊ยครับ

อย่าเสียเวลาเลย เอาตัวอย่างมาดูกันดีกว่า
(โม้นาน เดี๋ยวทำไม่ได้ล่ะยุ่งเลย 55+)
สมมุติว่าผมมีรูปถ่ายตุ๊กตาโดเรมอนอยู่รูปหนึ่ง
ซึ่งบังเอิญไปถ่ายมาได้ด้วยสภาพแสงน้อย
รูรับแสงกว้าง ความชื้นสัมพันธ์ต่ำ
สภาพคล่องในกระเป๋าตังค์มีน้อย (จะบอกทำไม ?)

เอาเป็นว่า ถ่ายมาได้รูปแบบนี้ล่ะ

Photobucket

ซึ่งก็ดูเกือบจะดีแล้ว
แต่มันยังไม่ถูกใจวัยรุ่นซึ่งชอบสีสันสดใส
ประหนึ่งดอกทานตะวันต้องการแสงแดดยามเช้า
(เวอร์ไปนั่น)

ทำไงดีล่ะครับ

คำตอบ: ง่ายมาก
เพียงคุณเปิดรูปด้วยโฟโต้แฉ่บ 😛
แล้วกด Ctrl+M (ทำเป็นไฮโซใช้คีย์ลัด :P)
หรือจิ้มที่เมนู Image->Adjustments->Curves..

คุณก็จะได้หน้าต่างหน้าตาแปลกๆเพิ่มมาอีกหนึ่งหน้าต่าง
หน้าตาประมาณนี้…

Photobucket

สิ่งต่อไปที่คุณต้องทำก็คือ
กดเมาส์ลากเส้นทแยงมุมในกรอบให้เบี้ยวไปประมาณรูปที่เห็น
โดยคุณจะสังเกตเห็นสีสันของรูปคุณเปลี่ยนไปตาม

อยากได้แบบไหนลากเอาตามมันส์ส่วนตัวได้ครับ

Photobucket

แต่ถ้าสำหรับมือใหม่หัดเบี้ยว
ผมมีข้อแนะนำง่ายๆ คือ พยายามลากให้มันเป็นโค้ง
เป็นแนวตัว s เอียงเหมือนตัวอย่าง แล้วจะดีเอง
(*) คำอธิบายเพิ่มเติมสำหรับคนอยากรู้ลึกๆ
ถ้าใครกลัวปวดหัวก็อ่านข้ามไปได้ครับ

การปรับเส้นกราฟของ Curves นี่จริงๆแล้ว
เป็นการคำนวณค่าสีใหม่จากสีเดิมครับ
ถ้าสังเกตข้างๆกรอบของกราฟ จะเป็นแถบขาวดำ(ไล่สี)
อยู่สองแถบ โดยแถบแนวนอนจะแทนสีเดิมในรูป
และแถบแนวตั้งจะแทนสีใหม่ในรูป
จากลากเส้นเปลี่ยนลักษณของกราฟ จะทำให้จุดตัดที่ลากขึ้น
จากแถบแนวนอนไปตัดเส้นกราฟแล้วชิ่งไปหาแถบทางซ้าย
เพื่อแทนด้วยค่าสีใหม่

Photobucket

แล้วโปรแกรมก็จะทำการแทนค่าสีแบบนี้ทั้งภาพจนได้
ภาพใหม่แบบที่เรามองเห็นๆกันอยู่นี่เอง
สำหรับคนที่สงสัยว่าทำไมต้องเป็น s-curve
อธิบายง่ายๆก็คือ เราเพิ่มความสว่างให้สีโซนสว่างให้มากขึ้น
แล้วลดความสว่าง(ทำให้มืด) ในส่วนที่สีควรจะมืด(หรือเข้ม)
ผลลัพธ์ที่ออกมา ถ้าพูดง่ายๆก็คือ สีสันส่วนใหญ่สดขึ้น
เพราะจริงๆมันเป็นการเพิ่ม Contrast ของภาพนั่นเองครับ

ถ้าปรับแต่เพียงพอดีก็คงไม่มีปัญหาอะไร
แต่ถ้าหากปรับมากเกินคุณอาจจะได้รูปสีฉูดฉาดเกินจำเป็นเช่น

Photobucket

ไม่รู้ว่าถ้าเป็นข้าวจริงๆจะยังกินลงกันมั๊ย ?
(^^”)

แต่กับบางรูปการปรับ curve จัดๆก็ช่วยเร่งสี
ให้ดูโดดเด่นขึ้นมาได้เหมือนกัน (แต่ไม่ทุกรูปนะ)

เช่น รูปนี้ (ดอกพญาเสือโคร่ง จ.น่าน)


Photobucket

ดอกลิลลี่ – จ. เชียงราย

Photobucket

ที่เหลือนอกนี้เป็นตัวอย่าง ก่อนและหลังการปรับ curve อย่างเดียวครับ
(หมายเหตุแค่นี้ก็ใช้หากินได้หลายแล้ว :P)


Photobucket

Photobucket

ทำให้หมาเหงา เหง๊าาา เหงา แบบสะอาดได้ด้วย 😛

Photobucket

ทำให้ป่าแห้งๆ หวานขึ้นมาจับใจได้ด้วย !!?

Photobucket

เร่งสี เร่งอารมณ์ !!

Photobucket

ไม่หวั่นแม้วันมืดมิด !!

Photobucket

ในกรณีที่สีที่ได้จากกล้องมาไม่ค่อยชัด
เราก็สามารถเร่งสีเร่งวุ้นได้แบบนี้ (ไม่ใช่ปลาทอง :P)

Photobucket

สำหรับบางรูปถ้าคุมกราฟดีๆ จะเปลี่ยนอารมณ์ของภาพได้เยอะเลย เช่นรูปนี้

Photobucket

หวังว่าจะใช้ประโยชน์กันได้บ้างนะครับ (^^)>

ps. ส่วนเรื่อง Dogde กับ Burn เอาไว้วันไหนมีตัวอย่างดีๆ
ค่อยมาสอนกันอีกทีล่ะกันเนอะ

ps2. คำเตือนกรุณาเก็บไฟล์ original แยกไว้ก่อนทำรูปเสมอ (แล้วจะหาว่าไม่เตือน)

FOR LOOP v.s. ITERATOR (My conclusion)

25 Wednesday Mar 2009

Posted by windygallery in Developer

≈ Leave a comment

Tags

for loop, iterator

For Loop
=======
Pros:
– Simple, Easy.

Cons:
– Not usable for filtering, replacing such as sorting.

Iterator
=======
Pros:
– Same interface for all Collections
– More flexible for changine content than for loop
– Suitable for passing (for more decoupling modules)

Cons:
– Easy to make a mistake (a bit) when writing

References:
http://java.sun.com/j2se/1.5.0/docs/guide/language/foreach.html
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html
http://forums.sun.com/thread.jspa?threadID=646493&start=0&tstart=0
http://forums.sun.com/thread.jspa?threadID=530365&messageID=2555464

Major Benefit of Data Structures.

25 Wednesday Mar 2009

Posted by windygallery in Developer

≈ Leave a comment

Tags

data structure

List
A list keeps elements in order — this is the primary tool for storing objects for later use.

Stack
A stack pays attention to the recent element, and well for tracking state transition,status.

Set
A set prevents duplicates, and is most often used to keep track of things

Hash
Fast access to value by using key, appropriate for keeping relations.

Queue
Queue is primarily for communicating between processes
(even if those processes happen to share the same thread): one process puts objects on the Queue,
the other process consumes the objects. All Queues in the standard Java library
keep the objects in the enqueueing order except for PriorityQueue.
LinkedList implements Queue, but most of the queue implementations are for concurrency.

Collection says that they are all basically the same thing to hold objects (but behaviors are quite different).
that’s necessary to unify them under a common interface.

Iterators (in Java) can also provide a safety mechanism
(by using fail-fast iterators to more easily spot bugs) against concurrent modifications.


Reference:
http://www.artima.com/weblogs/viewpost.jsp?thread=119193

Java: How to Measure My Coding’s Speed ?

25 Wednesday Mar 2009

Posted by windygallery in Developer

≈ Leave a comment

Tags

counter, getTime, java

By Coding
========

// capture first time for measuring
long timeA = System.currentTimeMillis();

// do your business
…

// capture second time for measuring
long timeB = System.currentTimeMillis();

// Calculate the different in milliseconds.
System.out.println(“It took you “+(timeB-timeA)+”ms. for ….”);

By Eclipse Profiler
===============

http://www.eclipse.org/tptp/index.php

SVN Tools

23 Monday Mar 2009

Posted by windygallery in Developer

≈ Leave a comment

Tags

svn, tools

Subversion.tigris.org
http://subversion.tigris.org/


Subclipse (SVN Plugin for Eclipse)

http://subclipse.tigris.org/install.html


Subversion for Windows

http://subversion.tigris.org/getting.html#windows

 

TortoiseSVN downloads

http://tortoisesvn.net/downloads

Special thanks: JuaCompe

Solution for Fail Fast problem {Java Programming}

22 Sunday Mar 2009

Posted by windygallery in Developer

≈ Leave a comment

Tags

Fail Fast, java

The Java containers also have a mechanism to prevent more than one process from modifying the contents of a container. The problem occurs if you’re iterating through a container and some other process steps in and inserts, removes, or changes an object in that container. Maybe you’ve already passed that object, maybe it’s ahead of you, maybe the size of the container shrinks after you call size( )—there are many scenarios for disaster. The Java containers library incorporates a fail-fast mechanism that looks for any changes to the container other than the ones your process is personally responsible for. If it detects that someone else is modifying the container, it immediately produces a ConcurrentModificationException. This is the “fail-fast” aspect—it doesn’t try to detect a problem later on using a more complex algorithm.

It’s quite easy to see the fail-fast mechanism in operation—all you have to do is create an iterator and then add something to the collection that the iterator is pointing to, like this:

//: c09:FailFast.java
// Demonstrates the "fail fast" behavior.
import java.util.*;

public class FailFast {
  public static void main(String[] args) {
    Collection c = new ArrayList();
    Iterator it = c.iterator();
    c.add("An object");
    // Causes an exception:
    String s = (String)it.next();
  }
} ///:~

The exception happens because something is placed in the container after the iterator is acquired from the container. The possibility that two parts of the program could be modifying the same container produces an uncertain state, so the exception notifies you that you should change your code—in this case, acquire the iterator after you have added all the elements to the container.

Note that you cannot benefit from this kind of monitoring when you’re accessing the elements of a List using get( ).

Reference: http://www.cs.waikato.ac.nz/~jcleary/230/TIJ/html/Chap09.htm#Index1036

Subscribe

  • Entries (RSS)
  • Comments (RSS)

Archives

  • August 2017
  • November 2015
  • August 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • May 2012
  • February 2011
  • January 2011
  • August 2010
  • June 2010
  • May 2010
  • April 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • April 2009
  • March 2009
  • November 2008
  • October 2008

Categories

  • Developer
  • Events
  • Games
  • IDeas
  • Love
  • Photos

Meta

  • Register
  • Log in

Blog at WordPress.com.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • WindyGallery's Weblog
    • Already have a WordPress.com account? Log in now.
    • WindyGallery's Weblog
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar