「Processing」を含む日記 RSS

はてなキーワード: Processingとは

2012-01-06

Article 14 the mobile phone will know the battery skills

If users want to prolong battery the efficient use of the time, in addition to the quality of the charger to have the guarantee, the right skills and charging is essential, because of low quality charger or wrong charging methods would affect battery time and life cycle, the following is about to charge skills:

1. The battery before they leave the factory, manufacturers were activated processing, and the charge, so the battery are more electricity, my friends say battery charging adjustment period in accordance with the time, standby still seriously insufficient, assuming that the battery is really quality goods battery of words, this kind of circumstance should extend the setting and then 3 ~ 5 times fully charge and discharge.

2. If new phone is lithium ion battery, so before 3 ~ 5 times charging commonly known as adjustment period, should be charged more than 14 hours, in order to ensure that the fully activate lithium ion activity. The lithium ion battery no memory effects, but have very strong sui sex, should give full activated PANASONIC CGR-D220 Battery, to guarantee the use of after can reach the right performance.

3. Some automation intelligent quick charger when instructions lights change, said only full of 90%. The charger will automatically change with slow charge will batteries. Best will use after batteries, otherwise, it will shorten use time.

4. Before charging and discharging lithium battery does not need special, but will not discharge damage to the battery. As far as possible when charging at the slow ChongChongDian, reduce the way quick charge; Time don't more than 24 hours. The battery after three to five times fully recharge cycles of internal after chemical will be all "activate" to achieve the best use effect.

5. Please use the original or the reputation of the good brand charger, li-ion battery to lithium battery charger with special, and follow the instructions, otherwise, it will damage to the battery, and even dangerous.

6. Have many users often in charge still leave her cell phone, actually such will be very easy to PANASONIC CGA-S101E/1B Battery damage the service life of the mobile phone, because in charge of the process, the circuit boards of mobile phone can calorific, if this time more exotic phone, may produce instant backflow current, internal parts to mobile phone damage.

7. The battery life depends on the number repeatedly charging and discharging, so should try to avoid more battery electric charge when, this will shorten battery life. Cell phone time more than 7 days, supposed to completely discharge the cell phone battery, enough electricity before use.

8. The cell phone battery have self-discharge, need not when the nimh batteries will press the residual capacity every day, about 1% of the discharge, lithium battery every day to 0.2% ~ 0.3% discharge. In for the battery, try to use the special socket, don't will the home appliance such as the Shared and the TV charger socket.

9. Though the phones in the network coverage area, but in the cell phone charge, cell phones have been unable to accept and call. At this time, can use of the mobile phone is not transfer function, will be transferred to the mobile phone side of fixed telephone in order to prevent calls lost, this kind of method for mobile phone is not in the network coverage of the area or weak signal and temporarily unable to the applicable also.

10. Don't will be exposed to high temperature or cold PANASONIC DMW-BCG10E Battery , as the dog, should not put the phone on the car, and the sun blazed through the; Or get air conditioning room, in air conditioning to be blown continuously place. When charging, the battery is a little heat is normal, but can't let it what the high temperature "suffer". In order to avoid the happening of this kind of circumstance, had better be in charge at room temperature, and don't cover anything on the mobile phone.

11. Nickel cadmium (N iCd) before the battery must ensure that the batteries are no electricity, recharging the battery must ensure that sufficient electricity after.

12. If the cell phone battery placed too long and not use, the best maintenance department to cell phones to the application for a live processing, also can use a constant dc voltage is the voltage adjustment for 5 ~ 6 V, current 500 ~ 600 mA reverse connect battery. Note that a touch namely release, the most repeated three times can, through such treatment after another, with the original adapter to "adaptation" charge.

13. Charge is not as long as possible, to no protection circuit batteries that should stop after charging, or the battery will with fever or overheating impact performance.

14. Lithium ion battery must choose special charger, otherwise may not reach the saturated state, affect their performance. Charging completes, should avoid to place in charger on more than 12 hours or more, long-term need not when should make a battery and cell phone separation.

2012-01-05

Types of digital cameras

Digital cameras are made in a wide range of sizes, prices and capabilities. The majority are camera phones, operated as a mobile application through the cellphone menu. Professional photographers and many amateurs use larger, more expensive digital single-lens reflex cameras (DSLR) for their greater versatility. Between these extremes lie digital compact cameras and bridge digital cameras that "bridge" the gap between amateur and professional cameras. Specialized cameras including multispectral imaging equipment and astrographs continue to serve the scientific, military, medical and other special purposes for which digital photography was invented.

[edit]Compact digital cameras


Subcompact with lens assembly retracted

Compact cameras are designed to be tiny and portable and are particularly suitable for casual and "snapshot" uses. Hence, they are also called point-and-shoot cameras. The smallest, generally less than 20 mm thick, are described as subcompacts or "ultra-compacts" and some are nearly credit card size.[2]

Most, apart from ruggedized or water-resistant models, incorporate a retractable lens assembly allowing a thin camera to have a moderately long focal length and thus fully exploit an image sensor larger than that on a camera phone, and a mechanized lens cap to cover the lens when retracted. The retracted and capped lens is protected from keys, coins and other hard objects, thus making it a thin, pocketable package. Subcompacts commonly have one lug and a short wrist strap which aids extraction from a pocket, while thicker compacts may have two lugs for attaching a neck strap.

Compact cameras are usually designed to be easy to use, sacrificing advanced features and picture quality for compactness and simplicity; images can usually only be stored using lossy compression (JPEG). Most have a built-in flash usually of low power, sufficient for nearby subjects. Live preview is almost always used to frame the photo. Most have limited motion picture capability. Compacts often have macro capability and zoom lenses but the zoom range is usually less than for bridge and DSLR cameras. Generally a contrast-detect autofocus system, using the image data from the live preview feed of the main imager, focuses the lens.

Typically, these cameras incorporate a nearly silent leaf shutter into their lenses.

For lower cost and smaller size, these cameras typically use image sensors with a diagonal of approximately 6 mm, corresponding to a crop factor around 6. This gives them weaker low-light performance, greater depth of field, generally closer focusing ability, and smaller components than cameras using larger sensors.

Starting in 2011, some compact digital cameras can take 3D still photos. These 3D compact stereo cameras can capture 3D panoramic photos for play back on a 3D TV.[3] Some of these are rugged and waterproof, and some have GPS, compass, barometer and altimeter. [4]

[edit]Bridge cameras


Sony DSC-H2

Main article: Bridge camera

Bridge are higher-end digital cameras that physically and ergonomically resemble DSLRs and share with them some advanced features, but share with compacts the use of a fixed lens and a small sensor. Like compacts, most use live preview to frame the image. Their autofocus uses the same contrast-detect mechanism, but many bridge cameras have a manual focus mode, in some cases using a separate focus ring, for greater control. They originally "bridged" the gap between affordable point-and-shoot cameras and the then unaffordable earlier digital SLRs.

Due to the combination of big physical size but a small sensor, many of these cameras have very highly specified lenses with large zoom range and fast aperture, partially compensating for the inability to change lenses. On some, the lens qualifies as superzoom. To compensate for the lesser sensitivity of their small sensors, these cameras almost always include an image stabilization system to enable longer handheld exposures.

These cameras are sometimes marketed as and confused with digital SLR cameras since the appearance is similar. Bridge cameras lack the reflex viewing system of DSLRs, are usually fitted with fixed (non-interchangeable) lenses (although some have a lens thread to attach accessory wide-angle or telephoto converters), and can usually take movies with sound. The scene is composed by viewing either the liquid crystal display or the electronic viewfinder (EVF). Most have a longer shutter lag than a true dSLR, but they are capable of good image quality (with sufficient light) while being more compact and lighter than DSLRs. High-end models of this type have comparable resolutions to low and mid-range DSLRs. Many of these cameras can store images in a Raw image format, or processed and JPEG compressed, or both. The majority have a built-in flash similar to those found in DSLRs.

In bright sun, the quality difference between a good compact camera and a digital SLR is minimal but bridgecams are more portable, cost less and have a similar zoom ability to dSLR. Thus a Bridge camera may better suit outdoor daytime activities, except when seeking professional-quality photos.[5]

In low light conditions and/or at ISO equivalents above 800, most bridge cameras (or megazooms) lack in image quality when compared to even entry level DSLRs. However, they do have one major advantage: their much larger depth of field due to the small sensor as compared to a DSLR, allowing larger apertures with shorter exposure times.

A 3D Photo Mode was introduced in 2011, whereby the camera automatically takes a second image from a slightly different perspective and provides a standard .MPO file for stereo display. [6]

[edit]Mirrorless interchangeable-lens camera

Main article: Mirrorless interchangeable-lens camera

In late 2008, a new type of camera emerged, combining the larger sensors and interchangeable lenses of DSLRs with the live-preview viewing system of compact cameras, either through an electronic viewfinder or on the rear LCD. These are simpler and more compact than DSLRs due to the removal of the mirror box, and typically emulate the handling and ergonomics of either DSLRs or compacts. The system is used by Micro Four Thirds, borrowing components from the Four Thirds DSLR system.

[edit]Digital single lens reflex cameras


Cutaway of an Olympus E-30 DSLR

Main article: Digital single-lens reflex camera

Digital single-lens reflex cameras (DSLRs) are digital cameras based on film single-lens reflex cameras (SLRs). They take their name from their unique viewing system, in which a mirror reflects light from the lens through a separate optical viewfinder. At the moment of exposure the mirror flips out of the way, making a distinctive "clack" sound and allowing light to fall on the imager.

Since no light reaches the imager during framing, autofocus is accomplished using specialized sensors in the mirror box itself. Most 21st century DSLRs also have a "live view" mode that emulates the live preview system of compact cameras, when selected.

These cameras have much larger sensors than the other types, typically 18 mm to 36 mm on the diagonal (crop factor 2, 1.6, or 1). This gives them superior low-light performance, less depth of field at a given aperture, and a larger size.

They make use of interchangeable lenses; each major DSLR manufacturer also sells a line of lenses specifically intended to be used on their cameras. This allows the user to select a lens designed for the application at hand: wide-angle, telephoto, low-light, etc. So each lens does not require its own shutter, DSLRs use a focal-plane shutter in front of the imager, behind the mirror.

[edit]Digital rangefinders

Main article: Rangefinder camera#Digital rangefinder

A rangefinder is a user-operated optical mechanism to measure subject distance once widely used on film cameras. Most digital cameras measure subject distance automatically using electro-optical techniques, but it is not customary to say that they have a rangefinder.

[edit]Line-scan camera systems

A line-scan camera is a camera device containing a line-scan image sensor chip, and a focusing mechanism. These cameras are almost solely used in industrial settings to capture an image of a constant stream of moving material. Unlike video cameras, line-scan cameras use a single row of pixel sensors, instead of a matrix of them. Data coming from the line-scan camera has a frequency, where the camera scans a line, waits, and repeats. The data coming from the line-scan camera is commonly processed by a computer, to collect the one-dimensional line data and to create a two-dimensional image. The collected two-dimensional image data is then processed by image-processing methods for industrial purposes.

Further information: Rotating line camera

[edit]Integration

Many devices include digital cameras built into or integrated into them. For example, mobile phones often include digital cameras; those that do are known as camera phones. Other small electronic devices (especially those used for communication) such as PDAs, laptops and BlackBerry devices often contain an integral digital camera, and most 21st century camcorders can also make still pictures.

Due to the limited storage capacity and general emphasis on convenience rather than image quality, almost all these integrated or converged devices store images in the lossy but compact JPEG file format.

Mobile phones incorporating digital cameras were introduced in Japan in 2001 by J-Phone. In 2003 camera phones outsold stand-alone digital cameras, and in 2006 they outsold all film-based cameras and digital cameras combined. These camera phones reached a billion devices sold in only five years, and by 2007 more than half of the installed base of all mobile phones were camera phones. Sales of separate cameras peaked in 2008. [7]

Integrated cameras tend to be at the very lowest end of the scale of digital cameras in technical specifications, such as resolution, optical quality, and ability to use accessories. With rapid development, however, the gap between mainstream compact digital cameras and camera phones is closing, and high-end camera phones are competitive with low-end stand-alone digital cameras of the same generation.

[edit]Waterproof


A Canon WP-1 waterproof 35 mm film camera

Waterproof digital cameras are digital cameras that can make pictures underwater. Waterproof housings have long been made but they cost almost as the cameras. Many waterproof digital cameras are shockproof and resistant to low temperatures; one of them is Canon PowerShot D10, one of the first underwater digital cameras.

These cameras become very popular during the holiday season, because many people want to save the best moments from their holidays at the seaside. Waterproof watches and mobile phones were produced earlier. Most makers of digital cameras also produce waterproof ones and every year they launch at least one new model, for example Sony, Olympus, Canon, Fuji.

Healthways Mako Shark, an early waterproof camera,[8] was launched in 1958 and cost around 25 dollars. It was a huge camera and pictures were black and white.



___________________________

http://www.gobatteryonline.com/canon-nb-9l-digital-camera-battery-gose.html

http://www.gobatteryonline.com/canon-lp-e5-digital-camera-battery-gose.html

http://www.gobatteryonline.com/canon-powershot-sd500-battery-charger-gose.html

2011-11-08

Thunderbird から Outlook 2007 にメールを移行

やー。面倒でした。



古い情報だと Outlook Express を経由しろと書いてあるので、後継であるらしいWindows Live Mail を経由して(Windows Live Mail からエクスポートする方法で)

Outlook に移行したのだが、どういうわけか宛名が文字列として移行されてしまい、xxx@example.com というメールアドレスの移行ができなかったんです



で eml → msg もしくは pst 形式への変換ソフトを探すのですが、無料ものが見つからなくてあんまり情報もありませんでした。が、ありましたよ!お兄さん。

これなら、msg ⇔ eml の相互変換ができますです



MrMAPI.exe

http://mfcmapi.codeplex.com/



ヘルプはっときますね。

====

MAPI data collection and parsing tool. Supports property tag lookup, error translation,
   smart view processing, rule tables, ACL tables, contents tables, and MAPI<->MIME conversion.
MrMAPI currently knows:
  3916 property tags
   801 dispids
    35 types
    58 guids
   148 errors
    27 smart view parsers

Usage:
   MrMAPI -?
   MrMAPI [-Search] [-Dispids] [-Number] [-Type <type>] <property number>|<property name>
   MrMAPI -Guids
   MrMAPI -Error <error>
   MrMAPI -ParserType <type> -Input <input file> [-Binary] [-Output <output file>]
   MrMAPI -Flag <flag value> [-Dispids] [-Number] <property number>|<property name>
   MrMAPI -Rules [-Profile <profile>] [-Folder <folder>]
   MrMAPI -Acl [-Profile <profile>] [-Folder <folder>]
   MrMAPI [-Contents | -HiddenContents] [-Profile <profile>] [-Folder <folder>] [-Output <output directory>]
          [-Subject <subject>] [-MessageClass <message class>] [-MSG] [-List]
   MrMAPI -ChildFolders [-Profile <profile>] [-Folder <folder>]
   MrMAPI -XML -Input <path to input file> -Output <path to output file>
   MrMAPI -FID [fid] [-MID [mid]] [-Profile <profile>]
   MrMAPI -MAPI | -MIME -Input <path to input file> -Output <path to output file> [-CCSFFlags <conversion flags>]
          [-RFC822] [-Wrap <Decimal number of characters>] [-Encoding <Decimal number indicating encoding>]
          [-AddressBook] [-Unicode] [-Charset CodePage CharSetType CharSetApplyType]

All switches may be shortened if the intended switch is unambiguous.
For example, -T may be used instead of -Type.

   Help:
   -?   Display expanded help.

   Property Tag Lookup:
   -S   (or -Search) Perform substring search.
           With no parameters prints all known properties.
   -D   (or -Dispids) Search dispids.
   -N   (or -Number) Number is in decimal. Ignored for non-numbers.
   -T   (or -Type) Print information on specified type.
           With no parameters prints list of known types.
           When combined with -S, restrict output to given type.
   -G   (or -Guids) Display list of known guids.

   Flag Lookup:
   -Fl  (or -Flag) Look up flags for specified property.
           May be combined with -D and -N switches, but all flag values must be in hex.

   Error Parsing:
   -E   (or -Error) Map an error code to its name and vice versa.
           May be combined with -S and -N switches.

   Smart View Parsing:
   -P   (or -ParserType) Parser type (number). See list below for supported parsers.
   -B   (or -Binary) Input file is binary. Default is hex encoded text.

   Rules Table:
   -R   (or -Rules) Output rules table. Profile optional.

   ACL Table:
   -A   (or -Acl) Output ACL table. Profile optional.

   Contents Table:
   -C   (or -Contents) Output contents table. May be combined with -H. Profile optional.
   -H   (or -HiddenContents) Output associated contents table. May be combined with -C. Profile optional
   -Su  (or -Subject) Subject of messages to output.
   -Me  (or -MessageClass) Message class of messages to output.
   -Ms  (or -MSG) Output as .MSG instead of XML.
   -L   (or -List) List details to screen and do not output files.

   Child Folders:
   -Chi (or -ChildFolders) Display child folders of selected folder.

   MSG File Properties
   -X   (or -XML) Output properties of an MSG file as XML.

   MID/FID Lookup
   -Fi  (or -FID) Folder ID (FID) to search for.
           If -FID is specified without a FID, search/display all folders
   -Mid (or -MID) Message ID (MID) to search for.
           If -MID is specified without a MID, display all messages in folders specified by the FID parameter.

   MAPI <-> MIME Conversion:
   -Ma  (or -MAPI) Convert an EML file to MAPI format (MSG file).
   -Mi  (or -MIME) Convert an MSG file to MIME format (EML file).
   -I   (or -Input) Indicates the input file for conversion, either a MIME-formatted EML file or an MSG file.
   -O   (or -Output) Indicates the output file for the convertion.
   -Cc  (or -CCSFFlags) Indicates specific flags to pass to the converter.
           Available values (these may be OR'ed together):
              MIME -> MAPI:
                CCSF_SMTP:        0x02
                CCSF_INCLUDE_BCC: 0x20
                CCSF_USE_RTF:     0x80
              MAPI -> MIME:
                CCSF_NOHEADERS:        0x0004
                CCSF_USE_TNEF:         0x0010
                CCSF_8BITHEADERS:      0x0040
                CCSF_PLAIN_TEXT_ONLY:  0x1000
                CCSF_NO_MSGID:         0x4000
                CCSF_EMBEDDED_MESSAGE: 0x8000
   -Rf  (or -RFC822) (MAPI->MIME only) Indicates the EML should be generated in RFC822 format.
           If not present, RFC1521 is used instead.
   -W   (or -Wrap) (MAPI->MIME only) Indicates the maximum number of characters in each line in the
           generated EML. Default value is 74. A value of 0 indicates no wrapping.
   -En  (or -Encoding) (MAPI->MIME only) Indicates the encoding type to use. Supported values are:
              1 - Base64
              2 - UUENCODE
              3 - Quoted-Printable
              4 - 7bit (DEFAULT)
              5 - 8bit
   -Ad  (or -AddressBook) Pass MAPI Address Book into converter. Profile optional.
   -U   (or -Unicode) (MIME->MAPI only) The resulting MSG file should be unicode.
   -Ch  (or -Charset) (MIME->MAPI only) Character set - three required parameters:
           CodePage - common values (others supported)
              1252  - CP_USASCII      - Indicates the USASCII character set, Windows code page 1252
              1200  - CP_UNICODE      - Indicates the Unicode character set, Windows code page 1200
              50932 - CP_JAUTODETECT  - Indicates Japanese auto-detect (50932)
              50949 - CP_KAUTODETECT  - Indicates Korean auto-detect (50949)
              50221 - CP_ISO2022JPESC - Indicates the Internet character set ISO-2022-JP-ESC
              50222 - CP_ISO2022JPSIO - Indicates the Internet character set ISO-2022-JP-SIO
           CharSetType - supported values (see CHARSETTYPE)
              0 - CHARSET_BODY
              1 - CHARSET_HEADER
              2 - CHARSET_WEB
           CharSetApplyType - supported values (see CSETAPPLYTYPE)
              0 - CSET_APPLY_UNTAGGED
              1 - CSET_APPLY_ALL
              2 - CSET_APPLY_TAG_ALL

   Universal Options:
   -I   (or -Input) Input file.
   -O   (or -Output) Output file or directory.
   -F   (or -Folder) Folder to scan. Default is Inbox. See list below for supported folders.
           Folders may also be specified by path:
              "Top of Information Store\Calendar"
           Path may be preceeded by entry IDs for special folders using @ notation:
              "@PR_IPM_SUBTREE_ENTRYID\Calendar"
           MrMAPI's special folder constants may also be used:
              "@12\Calendar"
              "@1"
   -Pr  (or -Profile) Profile for MAPILogonEx.
   -M   (or -MoreProperties) More properties. Tries harder to get stream properties. May take longer.
   -No  (or -NoAddins) No Addins. Don't load any add-ins.
   -On  (or -Online) Online mode. Bypass cached mode.
   -V   (or -Verbose) Verbose. Turn on all debug output.

Smart View Parsers:
    1 Additional Ren Entry IDs Ex
    2 Appointment Recurrence Pattern
    3 Conversation Index
    4 Entry Id
    5 Entry List
    6 Extended Folder Flags
    7 Extended Rule Condition
    8 Flat Entry List
    9 Folder User Fields Stream
   10 Global Object Id
   11 Property
   12 Property Definition Stream
   13 Recipient Row Stream
   14 Recurrence Pattern
   15 Report Tag
   16 Restriction
   17 Rule Condition
   18 Search Folder Definition
   19 Security Descriptor
   20 SID
   21 Task Assigners
   22 Time Zone
   23 Time Zone Definition
   24 Web View Persistence Object Stream
   25 Nickname Cache
   26 Encode Entry ID
   27 Decode Entry ID

Folders:
    1 Calendar
    2 Contacts
    3 Journal
    4 Notes
    5 Tasks
    6 Reminders
    7 Drafts
    8 Sent Items
    9 Outbox
   10 Deleted Items
   11 Finder
   12 IPM_SUBTREE
   13 Inbox
   14 Local Freebusy
   15 Conflicts
   16 Sync Issues
   17 Local Failures
   18 Server Failures
   19 Junk E-mail

Examples:
   MrMAPI PR_DISPLAY_NAME

   MrMAPI 0x3001001e
   MrMAPI 3001001e
   MrMAPI 3001

   MrMAPI -n 12289

   MrMAPI -t PT_LONG
   MrMAPI -t 3102
   MrMAPI -t

   MrMAPI -s display
   MrMAPI -s display -t PT_LONG
   MrMAPI -t 102 -s display

   MrMAPI -d dispidReminderTime
   MrMAPI -d 0x8502
   MrMAPI -d -s reminder
   MrMAPI -d -n 34050

   MrMAPI -p 17 -i webview.txt -o parsed.txt

2011-05-10

嫁が一心不乱に取っていたメモ

CPUcentral processing unitパソコンのいちばんだいじなところ

Intel → X86

IBM → PowerPC

・いろんな会社 → ARM

Intel会社)のX86win)と IBM会社)のPowerPCMac)は動かすための命令がぜんぜんちがう

↑むかしはmacwinでそれぞれのたんとうがわかれていた

PowerPCMacの上でwindowsつかえなかった

IntelWinのうえでmacはつかえなかった。

でもいろいろあってつかえるようになった。

ApplePowerPCをすてた。←マカーにとっては大事(MacOSのあたらしいver.はPowerPCはもうでなくて、Intelしかでなくなるから。)(いまいちばんあたらしいのが10.6(スノウレパードってやつ=Intelしかない)も iBookPowerPCで、最近のやつはIntelから入らない。)

Intelしかなくなったのはメーカーのつごう。

一因としてIntelは性能やコスパがいいCPUPowerPC

そうでもなくなってきた。そしてIntelノートPC向きでもあった。

でもどこの会社Intel X86をすてるかもしれない(微妙なとこ)。

それでARMに移行するかもしれない。

iPadにはIntelはいってない。ARMはいってる。

でもじゅうぶんパソコンみたいにつかえるから

一般むけPCARMでじゅうぶんなのでは?という声も。

でもphotoshop映像ソフト音楽ソフト…そういうのを

つかうひとたちはパソコンの性能をたかしたい。

そういうひとたちがあおりをくったときにどうなるか?

ARMはもともと省電力がうりで性能がうりのCPUはない。)

Appleは組み立て工場部品をあつめてくみたてる)

 (iPadとかを企画していろいろ部品をあつめる)

 (ほんとのくみたては中国とか台湾とかがやる)

IBM部品屋さん(CPUとかつくる)

演算装置processing unit)がいろいろ計算している

Intelピンチ?そうでもない。

パソコンだけではなく業務用の大きなコンピュータとかつくっている。

(業務用の大きいコンピュータと、パソコンの基本的なしくみは一緒。)

こわれてもだいじょうぶ、こわれにくい、そういうのをつくっているんです

省電力というテーマでつくったCPUという枠組みでARMというのがある

ARMという規格に適合したものをいろんなところがつくっている

Intelがつくる可能性もある(まだきいたことはない とだは)

次期windowsARM版が出る方向にあって 世界的なながれ

iBookプラスチック日常用)

PowerBook金属仕事用)(接続端子があますところなくついてる)(CPUがはやいのがのってる)

いまMacBookMacBookProがそういうわかれかたになっている(Proのほうがいろいろと性能がいい)

2011-03-14

福島原子力発電所CNNコメント欄 MIT科学者見解2【東日本巨大地震

When the diesel generators were gone, the reactor operators switched to emergency battery power. The batteries were designed as one of the backups to the backups, to provide power for cooling the core for 8 hours. And they did.

Within the 8 hours, another power source had to be found and connected to the power plant. The power grid was down due to the earthquake. The diesel generators were destroyed by the tsunami. So mobile diesel generators were trucked in.

This is where things started to go seriously wrong. The external power generators could not be connected to the power plant (the plugs did not fit). So after the batteries ran out, the residual heat could not be carried away any more.

At this point the plant operators begin to follow emergency procedures that are in place for a “loss of cooling event”. It is again a step along the “Depth of Defense” lines. The power to the cooling systems should never have failed completely, but it did, so they “retreat” to the next line of defense. All of this, however shocking it seems to us, is part of the day-to-day training you go through as an operator, right through to managing a core meltdown.

It was at this stage that people started to talk about core meltdown. Because at the end of the day, if cooling cannot be restored, the core will eventually melt (after hours or days), and the last line of defense, the core catcher and third containment, would come into play.

But the goal at this stage was to manage the core while it was heating up, and ensure that the first containment (the Zircaloy tubes that contains the nuclear fuel), as well as the second containment (our pressure cooker) remain intact and operational for as long as possible, to give the engineers time to fix the cooling systems.

Because cooling the core is such a big deal, the reactor has a number of cooling systems, each in multiple versions (the reactor water cleanup system, the decay heat removal, the reactor core isolating cooling, the standby liquid cooling system, and the emergency core cooling system). Which one failed when or did not fail is not clear at this point in time.

So imagine our pressure cooker on the stove, heat on low, but on. The operators use whatever cooling system capacity they have to get rid of as much heat as possible, but the pressure starts building up. The priority now is to maintain integrity of the first containment (keep temperature of the fuel rods below 2200°C), as well as the second containment, the pressure cooker. In order to maintain integrity of the pressure cooker (the second containment), the pressure has to be released from time to time. Because the ability to do that in an emergency is so important, the reactor has 11 pressure release valves. The operators now started venting steam from time to time to control the pressure. The temperature at this stage was about 550°C.

This is when the reports about “radiation leakage” starting coming in. I believe I explained above why venting the steam is theoretically the same as releasing radiation into the environment, but why it was and is not dangerous. The radioactive nitrogen as well as the noble gases do not pose a threat to human health.

At some stage during this venting, the explosion occurred. The explosion took place outside of the third containment (our “last line of defense”), and the reactor building. Remember that the reactor building has no function in keeping the radioactivity contained. It is not entirely clear yet what has happened, but this is the likely scenario: The operators decided to vent the steam from the pressure vessel not directly into the environment, but into the space between the third containment and the reactor building (to give the radioactivity in the steam more time to subside). The problem is that at the high temperatures that the core had reached at this stage, water molecules can “disassociate” into oxygen and hydrogen – an explosive mixture. And it did explode, outside the third containment, damaging the reactor building around. It was that sort of explosion, but inside the pressure vessel (because it was badly designed and not managed properly by the operators) that lead to the explosion of Chernobyl. This was never a risk at Fukushima. The problem of hydrogen-oxygen formation is one of the biggies when you design a power plant (if you are not Soviet, that is), so the reactor is build and operated in a way it cannot happen inside the containment. It happened outside, which was not intended but a possible scenario and OK, because it did not pose a risk for the containment.

So the pressure was under control, as steam was vented. Now, if you keep boiling your pot, the problem is that the water level will keep falling and falling. The core is covered by several meters of water in order to allow for some time to pass (hours, days) before it gets exposed. Once the rods start to be exposed at the top, the exposed parts will reach the critical temperature of 2200 °C after about 45 minutes. This is when the first containment, the Zircaloy tube, would fail.

And this started to happen. The cooling could not be restored before there was some (very limited, but still) damage to the casing of some of the fuel. The nuclear material itself was still intact, but the surrounding Zircaloy shell had started melting. What happened now is that some of the byproducts of the uranium decay – radioactive Cesium and Iodine – started to mix with the steam. The big problem, uranium, was still under control, because the uranium oxide rods were good until 3000 °C. It is confirmed that a very small amount of Cesium and Iodine was measured in the steam that was released into the atmosphere.

It seems this was the “go signal” for a major plan B. The small amounts of Cesium that were measured told the operators that the first containment on one of the rods somewhere was about to give. The Plan A had been to restore one of the regular cooling systems to the core. Why that failed is unclear. One plausible explanation is that the tsunami also took away / polluted all the clean water needed for the regular cooling systems.

The water used in the cooling system is very clean, demineralized (like distilled) water. The reason to use pure water is the above mentioned activation by the neutrons from the Uranium: Pure water does not get activated much, so stays practically radioactive-free. Dirt or salt in the water will absorb the neutrons quicker, becoming more radioactive. This has no effect whatsoever on the core – it does not care what it is cooled by. But it makes life more difficult for the operators and mechanics when they have to deal with activated (i.e. slightly radioactive) water.

But Plan A had failed – cooling systems down or additional clean water unavailable – so Plan B came into effect. This is what it looks like happened:

In order to prevent a core meltdown, the operators started to use sea water to cool the core. I am not quite sure if they flooded our pressure cooker with it (the second containment), or if they flooded the third containment, immersing the pressure cooker. But that is not relevant for us.

The point is that the nuclear fuel has now been cooled down. Because the chain reaction has been stopped a long time ago, there is only very little residual heat being produced now. The large amount of cooling water that has been used is sufficient to take up that heat. Because it is a lot of water, the core does not produce sufficient heat any more to produce any significant pressure. Also, boric acid has been added to the seawater. Boric acid is “liquid control rod”. Whatever decay is still going on, the Boron will capture the neutrons and further speed up the cooling down of the core.

The plant came close to a core meltdown. Here is the worst-case scenario that was avoided: If the seawater could not have been used for treatment, the operators would have continued to vent the water steam to avoid pressure buildup. The third containment would then have been completely sealed to allow the core meltdown to happen without releasing radioactive material. After the meltdown, there would have been a waiting period for the intermediate radioactive materials to decay inside the reactor, and all radioactive particles to settle on a surface inside the containment. The cooling system would have been restored eventually, and the molten core cooled to a manageable temperature. The containment would have been cleaned up on the inside. Then a messy job of removing the molten core from the containment would have begun, packing the (now solid again) fuel bit by bit into transportation containers to be shipped to processing plants. Depending on the damage, the block of the plant would then either be repaired or dismantled.

Now, where does that leave us?

・The plant is safe now and will stay safe.

Japan is looking at an INES Level 4 Accident: Nuclear accident with local consequences. That is bad for the company that owns the plant, but not for anyone else.

・Some radiation was released when the pressure vessel was vented. All radioactive isotopes from the activated steam have gone (decayed). A very small amount of Cesium was released, as well as Iodine. If you were sitting on top of the plants’ chimney when they were venting, you should probably give up smoking to return to your former life expectancy. The Cesium and Iodine isotopes were carried out to the sea and will never be seen again.

・There was some limited damage to the first containment. That means that some amounts of radioactive Cesium and Iodine will also be released into the cooling water, but no Uranium or other nasty stuff (the Uranium oxide does not “dissolve” in the water). There are facilities for treating the cooling water inside the third containment. The radioactive Cesium and Iodine will be removed there and eventually stored as radioactive waste in terminal storage.

・The seawater used as cooling water will be activated to some degree. Because the control rods are fully inserted, the Uranium chain reaction is not happening. That means the “main” nuclear reaction is not happening, thus not contributing to the activation. The intermediate radioactive materials (Cesium and Iodine) are also almost gone at this stage, because the Uranium decay was stopped a long time ago. This further reduces the activation. The bottom line is that there will be some low level of activation of the seawater, which will also be removed by the treatment facilities.

・The seawater will then be replaced over time with the “normal” cooling water

・The reactor core will then be dismantled and transported to a processing facility, just like during a regular fuel change.

Fuel rods and the entire plant will be checked for potential damage. This will take about 4-5 years.

・The safety systems on all Japanese plants will be upgraded to withstand a 9.0 earthquake and tsunami (or worse)

・I believe the most significant problem will be a prolonged power shortage. About half of Japan’s nuclear reactors will probably have to be inspected, reducing the nation’s power generating capacity by 15%. This will probably be covered by running gas power plants that are usually only used for peak loads to cover some of the base load as well. That will increase your electricity bill, as well as lead to potential power shortages during peak demand, in Japan.

If you want to stay informed, please forget the usual media outlets and consult the following websites:

http://www.world-nuclear-news.org/RS_Battle_to_stabilise_earthquake_reactors_1203111.html

http://bravenewclimate.com/2011/03/12/japan-nuclear-earthquake/

http://ansnuclearcafe.org/2011/03/11/media-updates-on-nuclear-power-stations-in-japan/

2010-07-26

http://anond.hatelabo.jp/20100726172331

いわゆる関数型言語ScalaProcessingC#の評価も欲しいです

クレクレ厨氏ねとか言わないでください

2010-05-10

趣味プログラミングを始めたいんですが

比較マイナーな(実用は抜きにして、あまり知名度のない)言語に取り組んでみたいのです。

入門書とかはなくても構わないので、人柱が必要そうな言語を教えてください。

今のところProcessingScalaに目をつけてます。

あと、こういうものを学ぶ前に前提の基礎知識というか、脳みそに入りやすくなるようなものがあれば教えてください。

2009-03-19

Skypeカスタマーサポートが酷すぎる件

というか、スカイプカスタマーサポート存在していない件。

海外電話をかける必要があり、スカイプから海外固定電話携帯電話と通話できるサービスを使おうと思って、スカイプクレジットを購入したつもりだった。

つもりだったというのは、決済したのにいまだにクレジットが加算されていないからだ。

いつものようにやたらと重いマイアカウントのページを開き、クレジットカード情報入力して、

煩雑な本人確認サービスをかいくぐってやっとのことでクレジット購入手続きを済ませたつもりだった。

決済完了の画面が出て、「通常、クレジットカードで直接申し込んだ注文の処理は15分以内に完了します」と書かれている。

が、一時間以上たった現在でもまったく加算される気配がない。

文句の一つでも言いたいと思い、問い合わせ窓口を探したが、日本語のページには問い合わせ窓口へのリンクが一切ない。

英語のページでヘルプデスクを探すも、いっこうに直接問い合わせる窓口へたどり着かない。

クレジットカードでカネを客に払わせ、フォローがないまま完全放置である。

30分ほどして、メールが届いた。

決済完了か? と思ったら、英文で

we're processing your order

(注文を処理中)

という件名だった。

本文には

Credit card transactions usually clear within one hour, but can take up to 24 hours.

クレジットカード決済には通常一時間以内に完了しますが、24時間かかることもあるよ)

と書いてある。

15分で終わると書いていたのは、どこの誰なのか。口あたりのよい嘘か。


メールには続きがある。

Few things to try out while you wait

(待っている間に試すべきいくらかのことがら)

http://www.skype.com/share/stories/

(他のユーザーがどうスカイプを使っているか、スカイプストーリーズで読もう)

http://accessories.skype.com

完璧ウェブカメラスカイプフォンを手に入れろ)


これは客を怒らせたくてやっていることなのだろうか。

それともP2Pネットワークの背後にはじつは誰もいなかったりするのだろうか。

無料サービスを使っている分にはスカイプはいいと思うが、

有料サービスはあまりにも胡散臭くて後悔した。

2009-03-12

これが何を意味するのか良くわからないが

現在ホッテントリ筆頭のKeyHoleTV

http://b.hatena.ne.jp/entry/http://www.lifehacker.jp/2009/03/keyholetv.html

苫米地氏が関係

http://ja.wikipedia.org/wiki/KeyHoleTV

ノート」内にある「SCOPE第1回成果発表プログラム」へのリンク

http://www.soumu.go.jp/joho_tsusin/scope/event/bessi.html

ページの最後に「次世代P2Pコンテンツ流通高度化技術に関する研究開発 コグニティブリサーチラボ株式会社 苫米地 英人」という発表

http://www.soumu.go.jp/joho_tsusin/scope/event/yokousyu/session10/kokusai3.pdf

pdfから抜粋。

誌上発表リスト

[1] Yasuaki Takebe,Hideki Mima,Hideto Tomabechi, “Conference on Natural Language Processing, An Efficient Information Retrieval Technique for P2P Content Sharing Systems”,The first International Joint(2004/3)

[2] Yasuaki Takebe,Hideki Mima,Hideto Tomabechi,“A Novel Method for Content Consistency and Efficient Full-Text Search for P2P Content Sharing Systems”,ACM SIGCOMM2004

[3] Yasuaki Takebe,Hideki Mima,Hideto Tomabechi,” Conference of Parallel and Distributed Systems, A New Method of Content Consistency Maintenance and Full-Text Search towards Secure and High-Performance P2P Content Sharing”,IEEE The 10th International

他2編


SIGCOMMに通ってるとはすごい、と思って調べてみた。

[1] http://www.rcl.cityu.edu.hk/ijcnlp04/prelimprogram.htm には見つからない。

[2] http://conferences.sigcomm.org/sigcomm/2004/conf_program.html には見つからない。

[3] http://www.informatik.uni-trier.de/~ley/db/conf/icpads/icpads2004.html には見つからない。

ひょっとして「出しました」ということか?

2009-02-18

[] <日本語> にほんご

[Resources] リンク集 Useful Link Resources

学習に役立つリンクを集めた言語学総合サイトなど。

  1. Jim Breen's Japanese Page
  2. Tae Kim’s Blog » Links
  3. Keiko Schneider's Bookmarks
  4. Japanese language learning tools on Web
  5. Learn Japanese - Japanese Language
  6. 授業で使えるWebサイト効果的な使い方
  7. オンライン小説情報リンク集オリジナル・一般向〜
  8. 日本語教材図書館*JLPT日本語能力試験対策と「みんなの日本語」教材データ
  9. Resources for Japanese Students and Educators (The Association of Teachers of Japanese)

[English/Japanese] 英語日本語を学ぶ Learning Japanese by English

  1. Jim Breen's Japanese Page
  2. Japanese language learning tools on Web
  3. Charles Kelly's Online Japanese Language Study Materials
  4. Japanese Idioms
  5. All Japanese All The Time Dot Com: How to learn Japanese. On your own, having fun and to fluency. » About
  6. Tae Kim's Japanese guide to Japanese grammar
  7. YASUKO'S NIHONGO HOUSE
  8. The Daily Yo-ji
  9. JGram - The Japanese Grammar database
  10. JPLANG | LOGIN
  11. Japanese: Vocabulary Guide | 日本語: ボキャブラリーガイド
  12. Learn Japanese - Japanese Language
  13. Nihongojouzu
  14. Yahoo! 360° - Japanese for you Everyday♪ - writing a letter 2
  15. Expressions used in Japanese Letters - How to write Japanese letters
  16. My Furusato: Home of Everything Japanese from History to Culture Through Humor and Art and now the Fountain of Youth to fantastic health and less disease.
  17. Japanese Language School - MLC Meguro Language Center(in Tokyo,Japan)

[Japanese/Japanese] 日本語日本語を学ぶ Learning Japanese by Japanese

  1. Learn Japanese--北嶋千鶴子日本語教室 Let's play in Japanese
  2. ひらがなタイムズ/サイトマップ
  3. 日本語勉強 - Japan Forum
  4. 日本語Q&A:スペースアルク
  5. 日本語Q&A
  6. 初級日本語 げんき オンライン:げんきな自習室
  7. nihon5ch.net::::TOP::::日本語言葉日本語の文法を考えるための素材とツールを提供するサイト
  8. 日本語教師の教案 みんなの日本語ハンドアウト
  9. 寺村誤用例集データベース
[Hiragana] ひらがな
  1. U-biq
  2. Kana Sensei
  3. オンライン日本語学習 (Online Japanese Practice)
  4. ローマ字表 (Chart for Romaji to Hiragana)
  5. POINTひらがなローマ字表|ぴよタイピング
  6. pc_roma.gif (GIF Image, 745x900 pixels)
  7. ひらがな
  8. あいうえお表でひらがなを覚えましょう!
  9. Romaji
[Kanji] 漢字
  1. Read The Kanji | Learn how to read japanese kanji!
  2. 学習ページ(岡山大学 Okayama Univ.)
  3. Learn Japanese Kanji Online : WebCMJ (名古屋大学 Nagoya Univ.)
  4. 初級日本語 げんき オンライン:げんきな自習室
  5. Most Frequent 1000 Kanji of the Japanese Language | Japanese Language Lessons: Let's Learn Japanese!
  6. 漢字の正しい書き順(筆順)のメニュー
  7. 漢字で学ぶ日本語
  8. Happy Rice ~ 漢字勉強しながら寄付をしよう! ~
[Grammer] 文法
  1. Tae Kim's Japanese guide to Japanese grammar
  2. JGram - The Japanese Grammar database
  3. NationMaster - Encyclopedia: Japanese grammar
  4. 日本語の文法のリスト - 一級
  5. ●ことばと文字にかかわるおぼえがき——「クルミノ コーボー」
  6. みんなの日本語 練習
  7. Learn Japanese Grammar Online : WebCMJ
  8. 外国人のための日本語学習について-J-Life
  9. Chopsticks New York
  10. JReK - Japanese Sentence Search

[Dictionary] オンライン辞書 Online Dictionaries

  1. WWWJDIC: Word Search
  2. 英辞郎(eijiro) on the WEB
  3. English to Japanese, Japanese to English On line Dictionary
  4. kanji romaji hiragana convert
  5. Japanese Dictionary Tangorin.com
  6. 漢和辞典 漢字辞書 漢和辞書 [無料]
  7. Wiktionary
  8. 時代日本語類語辞典 類語玉手箱 -- 類語辞典シソーラス

[Translation] 翻訳サイト Free Online Translation Sites

  1. WWWJDIC: Text/Word Translation
  2. Nice Translator - The fast, easy to use online translator

[Tool] 学習ツール Helpful Tools for Learning Language

  1. rikaichan | polarcloud.com
  2. Reading Tutor - チュウ太の道具箱
  3. フナハシ学習塾 ためになる?ページ

[Portal] 学習言語圏のポータルサイトテキストソース Portal Sites of Learning Language / Text Sources

学習言語ポータルサイトなど。

(For Beginners)

  1. Hiragana Times
  2. Yahoo!きっずニュース
  3. 学研キッズネット
  4. キッズ@nifty
  5. キッズgoo

[RSS] RSS feeds

ツールやリンクアップデート更新中の教材紹介記事など。

[Podcast] ポッドキャストリスニング教材 Podcasts / Listening Resources

  1. Learn Japanese Pod
  2. Nippon VoiceBlog
  3. Learn Japanese @ Japancast.net
  4. S-J-P Study Japanese Podcast
  5. PodcastDirectory - Japanese Podcast Search Results

[Youtube] 動画学習 Movie Resources

  1. YouTube - Let's Learn Japanese Basic 1: "I'm Yan" [Episode 1, Part A]
  2. Namasennsei's Japanese lessons - YouTube

[Culture] 文化マナー・生活習慣 Culture / Manner / Life Style

冠婚葬祭言語圏生活で必要な情報など

  1. OK World - Abundant Living Information for foreign residents in Japan
  2. Cultural News
  3. Japan Reference
  4. Web Japan : Top Page
  5. メニュー - 知っておこう 暮らしマナー
  6. Japan With Kids - The interactive online community for English speaking parents in Japan!
  7. みんなの知識【ちょっと便利帳】

[Set up] タイピング基礎、言語入力システムインストール Set up Instructions for the Absolute Beginners.

  1. Japanese Input | Japanese Language Lessons: Let's Learn Japanese!
  2. Google 日本語入力 - ダウンロード

(For Windows)

  1. Installing East Asian Language Support under Windows 2000 Professional
  2. How to set up the Japanese input system
  3. YouTube - learn how to install japanese input support for windows

(For Mac)

  1. macosxhints.com - More Kotoeri (Japanese input) tips

(In case you are using shared computer)

  1. Using Japanese font and IME at Internet Cafe 海外インターネットカフェ日本語を使う (フォント日本語変換IME
  2. Type in Japanese - Google Transliteration

[Vocabulary] ボキャブラリー、語彙習得

  1. 日本語の文法のリスト - 一級

[News] ニュースソース

  1. くらべる一面 : 新s あらたにす日経朝日読売

[Extensive Reading] 読み物(小説ブログなど) Novels / Blogs

  1. 青空文庫 Aozora Bunko
  2. The Baker Street Bakery > 音声化された青空文庫リンク集
  3. 青空文庫サウンドブックス
  4. 1000文字小説 [1000moji.com]
  5. 翻訳

[Search Word] 検索ワード Words and Sites for Searching Resources

  1. 日本語
  2. 学習
  3. 勉強
  4. 教育
  5. 方法
  6. 教材
  7. 翻訳
  8. 辞書
  9. 便利
  10. 役立つ
  11. 文法
  12. 練習

[Tips] お役立ち記事など

  1. Learn Japanese with Twitter | Jayhan Loves Design & Japan
  2. Beginning to learn Japanese
  3. 日本語文法 - Google ブックス

[Just For Fun] おまけ Bonus Materials

  1. Free Japanese Kanji Translation * JapaName *
  2. Rum and Monkey: The Name Generator Generator
  3. 日本語学マンガ
  4. Nihongo
  5. 感覚!「楽しむ漢字」の辞典
  6. ことわざデータバンク
  7. ユーモア誤用
  8. Funny Japanese mistakes - Japan Forums
  9. 擬音語擬態語 - 日本語を楽しもう! -
  10. Japanese: Vocabulary Guide | 日本語: ボキャブラリーガイド

[Unedited] 未編集備忘録 Transient stock/ Memorandum

  1. NHK高校講座 | ライブラリー
  2. JapanSoc - #1 Social Bookmarking Site for Japan
  3. 小説の書き方・リンク集
  4. 日本語俗語辞書 - 若者言葉新語死語流行語
  5. わかりやすい技術文章の書き方

(Information)

  1. Learning Japanese - Japan Forums
  2. The Japanese Page | TheJapanesePage.com
  3. How to write Japanese precisely

語学学習サイト個人的リンクメモ / Lists of Language Learning Links)

http://anond.hatelabo.jp/20090101193230

2008-10-17

http://anond.hatelabo.jp/20081006220009

YourFileHostのCAPTCHA画像をなんとかするの続き。

その後、適当にいじったら、手元環境で1枚あたり25秒くらい→だいたい2.5秒くらいで判別できるようになった。このくらいなら使えるかな。

速度向上に一番効いたのは、Token#importで画像を比較しているところの修正。他は細かい手直し。

使い方は前のやつと変わってません。

あと、テストに100枚くらいCAPTCHA画像食わせてみたけど、とりあえず全部正しく判定できた。

動作確認用のスクリプト (run.rb)

カレントディレクトリ以下にある*.gifCAPTCHA画像ファイル適当に判別するスクリプト。動作確認用にどうぞ。

後述のdecaptcha.rbと同じディレクトリ適当に置いてchmod +xしてね。

#!/usr/local/bin/ruby
$LOAD_PATH << File::dirname(File::expand_path($0))
require 'decaptcha'

STDOUT.sync = true

Dir.glob('*.gif').sort.each do |file|
  correct = File::basename(file, '.*')
  puts "Processing file: #{file}"
  start_time = Time.now
  ret = DeCAPTCHA.decode(file)
  elapsed = Time.now - start_time

  puts "  Result: #{ret} (=> #{(correct == ret) ? "Ok" : "Fail"})"
  puts "  Elapsed time: #{elapsed}"
  puts
end

コード (decaptcha.rb)

#!/usr/local/bin/ruby
require 'rubygems'
require 'gd2'
require 'pp'

#
#= CAPTCHA画像解析モジュール
# CAPTCHA画像ファイルを食わすとあら不思議Stringが出てくるよ。
# YourFileHostのやつに対応。
#
#== Usage
# decoded_str = DeCAPTCHA.decode("some_captcha_image.gif")  #=> String
# 失敗したらnilが返る。
#
module DeCAPTCHA
  DEBUG = false

  #=== CAPTCHA画像デコード
  # file::    画像ファイル名のパス
  # method::  未指定でよい。男は細かい事を気にするな。
  # returns:: CAPTCHA画像解析結果(String) or nil (デコード失敗時)
  def self.decode(file, method = DeCAPTCHA::Site::YourFileHost)
    return method.new(file).decode
  end



  #= CAPTCHA画像デコードクラス
  # このクラスサブクラスはimport, tokenize, stream_parseメソッドの
  # 実装を含む必要がある。
  class Site
    def initialize(file = nil)
      @pix = nil
      self.import(file) unless file.nil?
    end
    def decode
      return stream_parse(tokenize())
    end
  end

  #= YourFileHostのCAPTCHA画像を解析するクラス
  class Site::YourFileHost < Site
    def import(file)
      @pix = PixelMatrix.new.import(file)
      return self
    end

    # importしたイメージ(PixelMatrix)から、文字と思わしきパターンを
    # 抽出して上下マージンを切り取ってArrayにして返す。
    # returns:: Array of PixelMatrix
    def tokenize
      ret = []
      state = :initial
      for x in 0...@pix.width
        case state
        when :initial
          if !@pix.vline_blank?(x) then
            state = :tokenize
            pixel = PixelMatrix.new(0, 0, true)
            ret << pixel
            redo
          end
        when :tokenize
          if @pix.vline_blank?(x) then
            state = :initial
            next
          end
          x0 = pixel.width
          for y in 0...@pix.height
            pixel[x0, y] = @pix[x, y]
          end
        else
          raise 'NOTREACHED'
        end
      end

      ret.map! {|token| Token.new.import(token.cutoff_vmargin!) }
    end


    # PixelMatrixのArrayを受け取り、数字を判別。
    # tokens:: Array of PixelMatrix
    # returns:: String (判別結果)
    def stream_parse(tokens)
      rs = tokens.map {|x| x.guess.to_s }.join('')
      if rs.length != 4 then
        rs = nil
        if DEBUG then
          puts '- guess failed. dumping guess result of each token:'
          tokens.each_index do |i|
            print "##{i}:#{tokens[i].guess} "
            pp tokens[i].candidate
          end
          puts
        end
      end
      return rs
    end

    class Token
      @@digits = nil
      attr_accessor :candidate

      def initialize
        if @@digits.nil? then
          # 文字画像サンプルを作っておく
          @@digits = DIGITS_ASSOC.map {|digit|
            PixelMatrix.new(0, 0, true).import_array(digit) }
        end

        @candidate = Hash.new
      end

      # PixelMatrixを受け取り、文字画像サンプルと比較して
      # 一致率を計算しておく。
      # pixel:: PixelMatrix
      # returns:: self
      def import(pixel)
        @@digits.each_index do |i|
          digit = @@digits[i]

          if (digit.width - pixel.width).abs   > 4 or
             (digit.height - pixel.height).abs > 4 then
            @candidate[i] = -1  # サイズが違いすぎな場合、一致させない
            next
          end

          correct_bits = 0
          enlarged_width  = [digit.width,  pixel.width ].max
          enlarged_height = [digit.height, pixel.height].max
          for y in 0...enlarged_height
            dy = (y.to_f / digit.height * enlarged_height).to_i
            py = (y.to_f / pixel.height * enlarged_height).to_i
            for x in 0...enlarged_width
              dx = (x.to_f / digit.width * enlarged_width).to_i
              px = (x.to_f / pixel.width * enlarged_width).to_i
              correct_bits += 1 if digit[dx, dy] == pixel[px, py]
            end
          end

          @candidate[i] = correct_bits * 100 /
                          (enlarged_width * enlarged_height)
        end

        return self
      end

      # importのときの比較結果をもとに文字を推測
      # returns:: Fixnum or nil(失敗時)
      def guess
        digit, ratio = @candidate.sort {|a, b| a.last <=> b.last}.last
        digit = nil if ratio < 0 or ratio < 65
        return digit
      end
    end
  end


  #= 画素マトリックスクラス
  # 画像ファイルを食わせると、各ピクセル(画素)を2値(black(1) or white(0))に
  # 変換して、内部で保持する。
  # 以後、Matrixクラスのような感じで個々の画素アクセスできる。
  class PixelMatrix
    BLACK = 1
    WHITE = 0

    attr_accessor :width
    attr_accessor :height

    # width::  幅
    # height:: 高さ
    # is_flexible:: 自動的に伸張するか
    def initialize(width = 0, height = 0, is_flexible = false)
      @matrix = Hash.new {|hash, key| hash[key] = Hash.new(WHITE)}
      @width, @height, @flexible = width, height, is_flexible
    end

    # file:: 画像ファイル名のパス
    # brightness_threshold:: 画素を黒とみなす閾値 (0 - 255, default: 0x40)
    # returns:: self (DeCAPTCHA::PixelMatrix)
    def import(file, brightness_threshold = 0x40)
      gd = GD2::Image.import(file)
      @width, @height = gd.width, gd.height

      self.each_with_axis do |x, y|
        color = gd[x, y]
        greyscale = (color.red + color.green + color.blue) / 3
        self[x, y] = (greyscale > brightness_threshold) ?
          WHITE :
          BLACK
      end
      return self
    end

    def import_array(array)
      array.each_with_index do |str, y|
        str.split('').each_with_index do |c, x|
          self[x, y] = c.to_i
        end
      end
      return self
    end

    # PixelMatrixを画像ファイルとしてexport
    # file:: 新たに作る画像ファイル名のパス
    def export(file)
      gd = GD2::Image::IndexedColor.new(@width, @height)
      gd.palette << GD2::Color::WHITE
      gd.palette << GD2::Color::BLACK
      self.each_with_axis do |x, y|
        gd[x, y] = {
          WHITE => GD2::Color::WHITE,
          BLACK => GD2::Color::BLACK,
        }[self[x, y]]
      end
      gd.export(file)
      return self
    end

    # 指定された位置の画素を返す。
    # returns:: PixelMatrix::BLACK(1) or WHITE(0)
    def [](x, y)
      if !@flexible and !in_range?(x, y) then
        raise RangeError
      end
      return WHITE if !@matrix.has_key?(y)  # XXX: for optimize
      return @matrix[y][x]
    end

    # 画素に値を設定。
    # returns:: PixelMatrix::BLACK(1) or WHITE(0)
    def []=(x, y, val)
      unless in_range?(x, y) then
        raise RangeError unless @flexible
        @width  = (x >= @width)  ? x + 1 : @width
        @height = (y >= @height) ? y + 1 : @height
      end

      @matrix[y][x] = val
    end

    def in_range?(x, y)
      ((0...@width) === x and (0...@height) === y)
    end

    # 指定された軸をもとに画素を走査し、Arrayに変換。
    # 例えば、to_a(:vertical, 10) とすると、x == 10 な列を取り出して
    # Arrayにして返す。
    #
    # axis:: 軸を指定 (:vertical または :horizontal)
    # pos:: 位置を指定。_axis_で指定した軸と直交する軸における位置を指定。
    def to_a(axis, pos)
      {:vertical => lambda {
        (0...@height).map {|y| self[pos, y]}
       },
       :horizontal => lambda {
        (0...@width).map  {|x| self[x, pos]}
       },
      }[axis].call
    end

    # returns:: Array
    def hline(y)
      self.to_a(:horizontal, y)
    end

    # returns:: Array
    def vline(x)
      self.to_a(:vertical, x)
    end

    # X軸方向に画素を走査。
    # y:: どの位置で走査するか
    # returns:: 指定された軸の上にドットが存在: false, 無い: true
    def hline_blank?(y)
      return true if @matrix.has_key?(y) == false # XXX: for optimize
      for x in 0...@width
        return false if self[x, y] == BLACK
      end
      return true
    end

    # Y軸方向に画素を走査。
    # x:: どの位置で走査するか
    # returns:: 指定された軸の上にドットが存在: false, 無い: true
    def vline_blank?(x)
      for y in 0...@height
        return false if self[x, y] == BLACK
      end
      return true
    end

    # 上下のマージン削除した新しいPixelMatrixを返す。
    # returns:: PixelMatrix
    def cutoff_vmargin
      pixel = PixelMatrix.new(0, 0, true)
      head = 0
      tail = self.height - 1

      head.upto(tail) do |y|
        if !self.hline_blank?(y) then
          head = y
          break
        end
      end
      tail.downto(head) do |y|
        if !self.hline_blank?(y) then
          tail = y
          break
        end
      end

      head.upto(tail) do |y|
        0.upto(self.width - 1) do |x|
          pixel[x, y - head] = self[x, y]
        end
      end

      return pixel
    end
    
    # 自身の上下のマージン削除する。cutoff_vmarginの破壊版。
    # 速度稼ぎのために直接@matrixを触ったり、すこしずるをしている。
    # 効率は、ほんの少しだけ速くなったような誤差の範囲のような感じ。
    # returns:: self (PixelMatrix)
    def cutoff_vmargin!
      head = 0
      tail = self.height - 1

      head.upto(tail) do |y|
        if !self.hline_blank?(y) then
          head = y
          break
        end
      end
      tail.downto(head) do |y|
        if !self.hline_blank?(y) then
          tail = y
          break
        end
        @matrix.delete(y) if @matrix.has_key?(y)  # XXX
      end

      if head > 0 then
        head.upto(tail) do |y|
          next if !@matrix.has_key?(y)            # XXX
          @matrix[y - head] = @matrix.delete(y)   # XXX
        end
      end
      self.height = tail - head + 1

      return self
    end
    
    def each_with_axis
      for x in 0...@width
        for y in 0...@height
          yield(x, y)
        end
      end
    end
  end
end

class DeCAPTCHA::Site::YourFileHost::Token
DIGITS_ASSOC = [
  # 0
  ["00000000011111110000000000",
   "00000001111111111110000000",
   "00000011111000001111000000",
   "00001111111100010011110000",
   "00011111100000110000111000",
   "00111111000000100001111000",
   "00111111110001000001111100",
   "01111111000010000011111110",
   "01111100000110000111111110",
   "01111111000100000111111110",
   "11111100001000001111111111",
   "11100000001000011111111111",
   "11111000010000011111111111",
   "11111000110000111111111111",
   "10000000100001111111111111",
   "01100001000001111111111110",
   "01100010000011111111111110",
   "01100010000111111111111110",
   "00111100000111111111111100",
   "00011100001111111111111000",
   "00001100011111111111111000",
   "00001111111111111111100000",
   "00000011111111111111000000",
   "00000000111111111100000000"],
  # 1
  ["00001",
   "00111",
   "11111",
   "11111",
   "10001",
   "00001",
   "00001",
   "00001",
   "00001",
   "00001",
   "00001",
   "00001",
   "00001",
   "00001",
   "00001",
   "00001",
   "00001",
   "00001",
   "00001",
   "00001"],
  # 2
  ["0000011111111110000000",
   "0001111111111111000000",
   "0011110000000010000000",
   "0110000000000100000000",
   "1100000000001100011110",
   "1000000000001000001111",
   "1000000000010000000111",
   "1000000000110001111111",
   "1000000000100001111111",
   "1000000001000000011111",
   "0100000011000001111111",
   "0011000010000111111110",
   "0011000110000001111110",
   "0000001100000111111100",
   "0000001000011111110000",
   "0000011000000111100000",
   "0000110000000000000000",
   "0000111111111111111111",
   "0001111111111111111110",
   "0011111111111111111100",
   "0011111111111111111100",
   "0111111111111111111000",
   "0111111111111111110000"],
  # 3
  ["000000011111111110000000",
   "000001111111111111100000",
   "000011100000011111111000",
   "000111000000111111111000",
   "000110000001111111111100",
   "000100000001111111111100",
   "000100000011111111111100",
   "000110000111111111111000",
   "000010000111111111111000",
   "000000001111111111100000",
   "000000011111111111000000",
   "000000011111111110000000",
   "000000000000001100000000",
   "000000000000011100011100",
   "000000000000111000111110",
   "000000000000110000001110",
   "000000000001110001111111",
   "110000000011100011111111",
   "111000000111000000111110",
   "011100000110001111111100",
   "001111001110000111111000",
   "000011111100000011100000",
   "000000011000111000000000"],
  # 4
  ["0000000000011",
   "0000000000011",
   "0000000000111",
   "0000000001111",
   "0000000001111",
   "0000000011111",
   "0000000111111",
   "0000000110111",
   "0000001100111",
   "0000011100111",
   "0000011000111",
   "0000110000111",
   "0001110000111",
   "0001100000111",
   "0011000000111",
   "0111000000111",
   "0111111111111",
   "1111111111111",
   "0000000000111",
   "0000000000111",
   "0000000000111",
   "0000000000111",
   "0000000000111"],
  # 5
  ["000000001111111111111110",
   "000000011111111111111100",
   "000000111111111111111100",
   "000000111111111111111000",
   "000001111111111111110000",
   "000011100000000000000000",
   "000011011111111110000000",
   "000111111111111111000000",
   "001111100000000111000000",
   "001110000000000110001100",
   "000000000000000100011110",
   "000000000000001100000110",
   "000000000000011000011111",
   "000000000000011001111111",
   "000000000000110000011111",
   "000000000001100000111111",
   "110000000001100111111110",
   "011000000011000001111110",
   "011100000110000011111100",
   "001111000110011111111000",
   "000111111100001111110000",
   "000001111100000011000000",
   "000000001000011000000000"],
  # 6
  ["000000000000000110000000",
   "000000010001111111111000",
   "000001110000011100111100",
   "000011100000011000001000",
   "000111000011111000000000",
   "001111000001110000000000",
   "001110000000111100000000",
   "011110001111111111100000",
   "011100000111000011110000",
   "011000000010000001111000",
   "011000011110000011111100",
   "010000111100000111111110",
   "100000001000000111111110",
   "100001111000001111111111",
   "000011110000011111111111",
   "000000100000011111111111",
   "000011100000111111111111",
   "001111000001111111111110",
   "000010000001111111111110",
   "001110000011111111111100",
   "000111000111111111111000",
   "000011111111111111110000",
   "000000111111111111000000",
   "000000000111111000000000"],
  # 7
  ["0011111111111110001111",
   "0011111111111100000011",
   "0111111111111000000110",
   "1111111111111000111100",
   "1111111111110000001100",
   "0000000000000000011000",
   "0000000000000011111000",
   "0000000011000000110000",
   "0000001110000011100000",
   "0000011110001111100000",
   "0000111100000011000000",
   "0001111000000110000000",
   "0001111000111110000000",
   "0011110000001100000000",
   "0011110000001000000000",
   "0011100011111000000000",
   "0011000001110000000000",
   "0001000000110000000000",
   "0000000111100000000000",
   "0000000111000000000000",
   "0000000011000000000000",
   "0000001110000000000000",
   "0000001100000000000000"],
  # 8
  ["0000000111111111110000000",
   "0000011111111111111100000",
   "0000001111100000011110000",
   "0000000001110000000111000",
   "0011000011111000000011100",
   "0011100001111100000011100",
   "0011110000001110000011100",
   "0001111000011111000111000",
   "0000111100000111101110000",
   "0000011110000001111100000",
   "0000001111000011111110000",
   "0000111111110000011111000",
   "0011110011111000001111100",
   "0111100001111100011111100",
   "0111000000111110000111110",
   "1111000000011111000000111",
   "1111000000001111100011111",
   "1111000000000011111000010",
   "0111100000000001111100000",
   "0011110000000000111110000",
   "0001111110000001111110000",
   "0000011111111111111000000",
   "0000000011111110000000000"],
  # 9
  ["000000111111111110000000",
   "000001111111111111100000",
   "000111111111111001111000",
   "001111111111110000010000",
   "011111111111110000010000",
   "011111111111100000100000",
   "011111111111000001100000",
   "111111111110000001000111",
   "111111111110000010000001",
   "111111111100000110000111",
   "011111111000000100011111",
   "011111111000001000001111",
   "001111110000011000011111",
   "001111100000010001111110",
   "000111110000100000011110",
   "000001111111100000111110",
   "000000011111000111111100",
   "000000000010000001111100",
   "000000000110000001111000",
   "000100001100011111110000",
   "000111001100001111100000",
   "000011111000001111000000",
   "000000010000110000000000"],
]
end
__END__

2008-10-12

[][]Grass

Table of Contents: ||||||

オープンソースソフトウェアGIS Open Source software and GIS Open Source software and GIS 1 (6)
オープンソース概念 Open Source concept 1 (2)
オープンソースGISとしてのGRASS GRASS as an Open Source GIS 3 (2)
ノースカロライナサンプルデータセット The North Carolina sample data set 5 (1)
この本の読み方 How to read this book 5 (2)
GIS概念 GIS concepts GIS concepts 7 (14)
一般的なGIS原理 General GIS principles 7 (6)
地理空間データモデル Geospatial data models 7 (4)
GISデータシステムの構成 Organization of GIS data and system 11 (2)
機能 functionality
地図投影法と座標系 Map projections and coordinate systems 13 (8)
地図投影原理 Map projection principles 13 (3)
一般的な座標系とdatums Common coordinate systems and datums 16 (5)
GRASSをはじめよう Getting started with GRASS Getting started with GRASS 21 (32)
第一歩 First steps 21 (16)
GRASSダウンロードインストール Download and install GRASS 21 (2)
データベースコマンド構造 Database and command structure 23 (3)
GRASS6のためのグラフィカルユーザインタフェイス: Graphical User Interfaces for GRASS 6: 26 (1)
QGISgis.m QGIS and gis.m
ノースカロライナを用いてGRASSを開始 Starting GRASS with the North Carolina 27 (3)
データセット data set
GRASSデータディスプレイ3D可視化 GRASS data display and 3D visualization 30 (4)
プロジェクトデータ管理 Project data management 34 (3)
新しいプロジェクトGRASSを開始 Starting GRASS with a new project 37 (7)
aのための座標系の定義 Defining the coordinate system for a 40 (4)
新しいプロジェクト new project
空間投影されていないxy座標系 Non-georeferenced xy coordinate system 44 (1)
座標系の変換 Coordinate system transformations 44 (9)
座標系のリスト Coordinate lists 45 (2)
ラスタベクトル地図投影 Projection of raster and vector maps 47 (1)
GDAL/OGRツールで、再投影 Reprojecting with GDAL/OGR tools 48 (5)
GRASSデータモデルデータの交換 GRASS data models and data exchange 53 (30)
ラスタデータ Raster data 54 (16)
GRASS2Dの、3Dラスタデータモデル GRASS 2D and 3D raster data models 54 (2)
領域の統合と境界 Managing regions and boundaries raster map resolution
ジオコードされたラスタデータインポート Import of georeferenced raster data 58 (8)
スキャンされた歴史地図インポートとジオコーディング Import and geocoding of a scanned 66 (3)
ラスタデータエクスポート Raster data export 69 (1)
ベクトルデータ Vector data 70 (13)
GRASSベクトルデータモデル GRASS vector data model 70 (3)
ベクトルデータインポート Import of vector data 73 (5)
xy CAD描画のための座標変換 Coordinate transformation for xy CAD drawings 78 (2)
ベクトルデータエクスポート Export of vector data 80 (3)
ラスタデータを使う Working with raster data 83 (86)
ラスタ地図を表示、管理 Viewing and managing raster maps 83 (22)
ラスタデータの表示と、カラーテーブルの割り当て Displaying raster data and assigning a color table 83 (3)
ラスタ地図に関するメタデータを管理 Managing metadata of raster maps 86 (2)
ラスタ地図クエリプロファイル Raster map queries and profiles 88 (2)
ラスタ地図統計 Raster map statistics 90 (1)
ラスタ地図ズームと、部分集合の生成 Zooming and generating subsets from 91 (1)
簡単なラスタ地図の生成 Generating simple raster maps 92 (2)
再分類と再スケーリング Reclassification and rescaling of 94 (3)
ラスタ地図 raster maps
ラスタ地図タイプの記録と値の置換 Recoding of raster map types and value replacements 97 (2)
カテゴリベルの割り当て Assigning category labels 99 (4)
マスキングとノーデータ値の取り扱い Masking and handling of no-data values 103(2)
ラスタ地図の計算 Raster map algebra 105(10)
整数と浮動小数点データ Integer and floating point data 107(1)
基本的な計算 Basic calculations 108(1)
“if"状態を使う Working with ``if'' conditions 109(1)
r.mapcalcのNULL値の取り扱い Handling of NULL values in r.mapcalc 110(1)
r.mapcalcでMASKを作成 Creating a MASK with r.mapcalc 111(1)
特別なグラフ演算子 Special graph operators 112(1)
相対的座標での近傍演算 Neighborhood operations with relative coordinates 113(2)
ラスタデータの変換と内挿 Raster data transformation and interpolation 115(11)
離散的ラスタデータ自動ベクトル Automated vectorization of discrete raster data 115(3)
連続フィールドの等値線の描画を生成 Generating isolines representing continuous fields 118(1)
ラスタデータのリサンプリングと内挿 Resampling and interpolation of raster data 119(5)
ラスタ地図オーバーレイマージ Overlaying and merging raster maps 124(2)
ラスタデータの空間分析 Spatial analysis with raster data 126(29)
近傍分析とクロスカテゴリー統計 Neighborhood analysis and cross-category statistics 126(7)
ラスタフィーチャのバッファリング Buffering of raster features 133(2)
コストサーフェイス Cost surfaces 135(5)
地勢と分水界分析 Terrain and watershed analysis 140(13)
ランドスケープ構造解析 Landscape structure analysis 153(2)
ランドスケーププロセスモデリング Landscape process modeling 155(11)
文学的、地下水モデル Hydrologic and groundwater modeling 155(3)
浸食と宣誓証言モデル Erosion and deposition modeling 158(8)
ラスタベースモデルと解析に関するまとめ Final note on raster-based modeling and analysis 166(1)
ボクセルデータを使う Working with voxel data 166(3)
ベクトルデータを使う Working with vector data 169(94)
地図の表示とメタデータ管理 Map viewing and metadata management 169(4)
ベクトル地図を表示 Displaying vector maps 169(3)
ベクトル地図メタデータ維持 Vector map metadata maintenance 172(1)
ベクトル地図属性管理とSQLサポート Vector map attribute management and SQL support 173(14)
GRASS6でのSQLサポート SQL support in GRASS 6 174(7)
サンプルSQLクエリ属性変更 Sample SQL queries and attribute modifications 181(4)
地図再分類 Map reclassification 185(1)
複数の属性があるベクトル地図 Vector map with multiple attribute tables: layers 186(1)
ベクトルデータデジタル Digitizing vector data 187(5)
位相データデジタル化の一般原理 General principles for digitizing topological data 187(2)
GRASSでの対話的なデジタイジン Interactive digitizing in GRASS 189(3)
ベクトル地図クエリ統計 Vector map queries and statistics 192(4)
地図クエリ Map queries 192(2)
ベクトルオブジェクトに基づくラスタ地図統計 Raster map statistics based on vector objects 194(2)
ポイントベクトル地図統計 Point vector map statistics 196(1)
幾何学操作 Geometry operations 196(20)
位相的な操作 Topological operations 197(6)
バッファリング Buffering 203(1)
フィーチャの抽出と境界のディゾルブ Feature extraction and boundary dissolving 204(1)
ベクトル地図を修理 Patching vector maps 205(1)
ベクトル地図インターセクディングとクリッピング Intersecting and clipping vector maps 206(3)
ベクトル幾何の変換と3Dベクトルの作成 Transforming vector geometry and creating 3D vectors 209(2)
点からのコンベックスハルとトライアンギュレーション Convex hull and triangulation from points 211(1)
同じ位置の掘り出し物の複数のポイント Find multiple points in same location 212(2)
一般的な多角形境界の長さ Length of common polygon boundaries 214(2)
ベクトルネットワーク分析 Vector network analysis 216(11)
ネットワーク分析 Network analysis 216(5)
直線的な参照システム(LRS) Linear reference system (LRS) 221(6)
ラスタへのベクトルデータ変化 Vector data transformations to raster 227(3)
空間的な内挿と近似 Spatial interpolation and approximation 230(19)
内挿方法を選択 Selecting an interpolation method 230(5)
RSTによる内挿と近似 Interpolation and approximation with RST 235(2)
RSTパラメタの調整: テンションスムージング Tuning the RST parameters: tension and smoothing 237(4)
RSTの精度を評価 Estimating RST accuracy 241(3)
セグメント化処理 Segmented processing 244(3)
RSTとのトポグラフィー分析 Topographic analysis with RST 247(2)
ライダーポイントクラウドデータを使う Working with lidar point cloud data 249(8)
ボリュームに基づくは内挿 Volume based interpolation 257(6)
3番目の変数の追加: 高度のある降水量 Adding third variable: precipitation with elevation 258(3)
ボリュームとボリューム-時間内挿 Volume and volume-temporal interpolation 261(1)
地球統計学とスプライ Geostatistics and splines 262(1)

2008-10-06

YourFileHostのCAPTCHA画像をなんとかする

破ろうぜ!CAPTCHA画像♪(うっうーん)

そんなわけで、みんな大好きなYourFileHostだけども、最近みてみたら、なんかCAPTCHA認証がついているわけじゃないですか。

でもこれってさーCAPTCHAといっても見るからに危ういというか、見れば見るほど簡単に破れてしまいそうな気がして、どうにもむずがゆいアンニュイな気分になってしまうわけです。

そんで、このたび適当にいじってみたところ、それなりに推測できるコードが書けたので、ここに張ってみますね。

やってることは単純で、こんな感じ

  1. CAPTCHA画像ファイルをよみこむ
  2. ピクセルごとにグレイスケールにして、それで2値にする
  3. この時点でじゃまな背景が消えて、文字の形がわかってしまうわけです
  4. 縦軸に点がないところで切って、文字ごとにばらばらにする
  5. 文字画像のサンプルと比較して、一致率が高いものを採用

使い方は、こんな感じで

require 'decaptcha.rb'
captcha_string = DeCAPTCHA.decode(filename)
if !captcha_string.nil? then
  # 判別成功時の処理
else
  # 判別失敗時の処理。失敗することもあるのでよしなに。
end

あ、Ruby/GD2入れといてね。sudo gem install gd2とかで入ります。多分。

判別率はそこそこ良い感じになったんだけども、富豪プログラミングがたたってか、いかんせん遅いです。

手元だと1枚判別するのに20秒くらいかかることもある。

そんなわけで誰かチューニングしてくれるとうれしい。

追記

実行速度を上げた改良版はこっちにうpしました。以下のコードは参考程度に。

コード (decaptcha.rb)

#!/usr/local/bin/ruby
require 'rubygems'
require 'gd2'
require 'pp'

#
#= CAPTCHA画像解析モジュール
# CAPTCHA画像ファイルを食わすとあら不思議Stringが出てくるよ。
# YourFileHostのやつに対応。
#
#== Usage
# decoded_str = DeCAPTCHA.decode("some_captcha_image.gif")  #=> String
# 失敗したらnilが返る。
#
module DeCAPTCHA
  DEBUG = false

  #=== CAPTCHA画像デコード
  # file::    画像ファイル名のパス
  # method::  未指定でよい。男は細かい事を気にするな。
  # returns:: CAPTCHA画像解析結果(String) or nil (デコード失敗時)
  def self.decode(file, method = DeCAPTCHA::Site::YourFileHost)
    return method.new(file).decode
  end



  #= CAPTCHA画像デコードクラス
  # このクラスサブクラスはimport, tokenize, stream_parseメソッドの
  # 実装を含む必要がある。
  class Site
    def initialize(file = nil)
      @pix = nil
      self.import(file) unless file.nil?
    end
    def decode
      return stream_parse(tokenize())
    end
  end

  #= YourFileHostのCAPTCHA画像を解析するクラス
  class Site::YourFileHost < Site
    def import(file)
      @pix = PixelMatrix.new.import(file)
      return self
    end

    # importしたイメージ(PixelMatrix)から、文字と思わしきパターンを
    # 抽出して上下マージンを切り取ってArrayにして返す。
    # returns:: Array of PixelMatrix
    def tokenize
      getter, tokenizer = lambda {|queue|
        [ lambda { return queue },
          lambda {|x, pixel|
            if pixel.nil? then
              x, pixel = tokenizer.call(x, PixelMatrix.new(0, 0, true))
              queue << pixel
              return x
            end
  
            if !@pix.in_range?(x, 0) or @pix.vline_blank?(x) then
              return [x, pixel]
            end
            x0 = pixel.width
            @pix.vline(x).inject(0) do |y, color|
              pixel[x0, y] = color
              y + 1
            end
            return tokenizer.call(x + 1, pixel)
          }
        ]
      }.call([])

      x = 0
      while (x < @pix.width)
        x = @pix.vline_blank?(x) ?
          x + 1 :
          tokenizer.call(x, nil)
      end

      getter.call.map do |token|
        # Token.new.import(token.cutoff_vmargin.shrink)
        Token.new.import(token.cutoff_vmargin)
      end
    end

    # PixelMatrixのArrayを受け取り、数字を判別。
    # tokens:: Array of PixelMatrix
    # returns:: String (判別結果)
    def stream_parse(tokens)
      r = []
      tokens.inject(nil) do |prev, cur|
        r << cur.guess
      end

      rs = r.map {|x| x.to_s}.join('')
      if rs.length != 4 then
        if DEBUG then
          puts '- guess failed. dumping guess result of each token:'
          tokens.each_index do |i|
            print "##{i}: "
            pp tokens[i].candidate
          end
          puts
        end
        return nil
      end
      return rs
    end

    class Token
      @@digits = nil
      attr_accessor :candidate

      def initialize
        if @@digits.nil? then
          # 文字画像サンプルを作っておく
          @@digits = DIGITS_ASSOC.map {|assoc|
            PixelMatrix.new(0, 0, true).import_assoc(assoc) }
        end

        @candidate = Hash.new
      end

      # PixelMatrixを受け取り、文字画像サンプルと比較して
      # 一致率を計算しておく。
      # pixel:: PixelMatrix
      # returns:: self
      def import(pixel)
        gcd = lambda {|a, b|
          a, b = [b, a] if a < b
          return a if b == 0
          r = a % b
          return gcd.call(b, r)
        }
        lcm = lambda {|a, b| a * b / gcd.call(a, b) }
        mul_to_lcm = lambda {|a, b|
          g = gcd.call(a, b)
          [b / g, a / g]
        }

        0.upto(@@digits.size - 1) do |i|
          if (@@digits[i].width - pixel.width).abs   > 4 or
             (@@digits[i].height - pixel.height).abs > 4 then
            @candidate[i] = -1  # 比較対象とサイズが違いすぎ
            next
          end

          mul_ax, mul_bx = mul_to_lcm.call(@@digits[i].width,  pixel.width)
          mul_ay, mul_by = mul_to_lcm.call(@@digits[i].height, pixel.height)
          enlarged_width  = @@digits[i].width  * mul_ax
          enlarged_height = @@digits[i].height * mul_ay

          # 文字画像サンプルと比較対象画像のサイズをあわせる
          # 幅・高さをそれぞれ適当整数倍して、最小公倍数に合わせて比較
          # (めんどうだから)
          correct_bits = 0
          (0...enlarged_width).each do |x|
            (0...enlarged_height).each do |y|
              if @@digits[i][x/mul_ax, y/mul_ay] ==
                 pixel[x/mul_bx, y/mul_by] then
                correct_bits += 1
              end
            end
          end
          
          @candidate[i] = correct_bits * 100 /
                          (enlarged_width * enlarged_height)
        end

        return self
      end

      # importのときの比較結果をもとに文字を推測
      # returns:: Fixnum or nil(失敗時)
      def guess
        digit, ratio = @candidate.sort {|a, b| a.last <=> b.last}.last
        digit = nil if ratio < 0 or ratio < 80
        return digit
      end
    end
  end


  #= 画素マトリックスクラス
  # 画像ファイルを食わせると、各ピクセル(画素)を2値(black(1) or white(0))に
  # 変換して、内部で保持する。
  # 以後、Matrixクラスのような感じで個々の画素アクセスできる。
  class PixelMatrix
    BLACK = 1
    WHITE = 0

    attr_accessor :width
    attr_accessor :height

    # width::  幅
    # height:: 高さ
    # is_flexible:: 自動的に伸張するか
    def initialize(width = 0, height = 0, is_flexible = false)
      @matrix = Hash.new {|hash, key| hash[key] = Hash.new(WHITE)}
      @width, @height, @flexible = width, height, is_flexible
    end

    # file:: 画像ファイル名のパス
    # brightness_threshold:: 画素を黒とみなす閾値 (0 - 255, default: 0x40)
    # returns:: self (DeCAPTCHA::PixelMatrix)
    def import(file, brightness_threshold = 0x40)
      gd = GD2::Image.import(file)
      @width, @height = gd.width, gd.height

      self.each_with_axis do |x, y|
        color = gd[x, y]
        greyscale = (color.red + color.green + color.blue) / 3
        self[x, y] = (greyscale > brightness_threshold) ?
          WHITE :
          BLACK
      end
      return self
    end

    # reverse function of to_assoc
    def import_assoc(assoc)
      assoc.inject(0) do |y, columns|
        columns.inject(0) do |x, color|
          self[x, y] = color
          x + 1
        end
        y + 1
      end
      return self
    end

    # PixelMatrixを画像ファイルとしてexport
    # file:: 新たに作る画像ファイル名のパス
    def export(file)
      gd = GD2::Image::IndexedColor.new(@width, @height)
      gd.palette << GD2::Color::WHITE
      gd.palette << GD2::Color::BLACK
      self.each_with_axis do |x, y|
        gd[x, y] = {
          WHITE => GD2::Color::WHITE,
          BLACK => GD2::Color::BLACK,
        }[self[x, y]]
      end
      gd.export(file)
      return self
    end

    def to_assoc
      (0...@height).map do |y|
        (0...@width).map do |x|
          self[x, y]
        end
      end
    end

    # 指定された位置の画素を返す。
    # returns:: PixelMatrix::BLACK(1) or WHITE(0)
    def [](x, y)
      if !@flexible and !in_range?(x, y) then
        raise RangeError
      end
      return @matrix[y][x]
    end

    # 画素に値を設定。
    # returns:: PixelMatrix::BLACK(1) or WHITE(0)
    def []=(x, y, val)
      unless in_range?(x, y) then
        raise RangeError unless @flexible
        @width  = (x >= @width)  ? x + 1 : @width
        @height = (y >= @height) ? y + 1 : @height
      end

      @matrix[y][x] = val
    end

    def in_range?(x, y)
      ((0...@width) === x and (0...@height) === y)
    end

    # 指定された軸をもとに画素を走査し、Arrayに変換。
    # 例えば、to_a(:vertical, 10) とすると、x == 10 な列を取り出して
    # Arrayにして返す。
    #
    # axis:: 軸を指定 (:vertical または :horizontal)
    # pos:: 位置を指定。_axis_で指定した軸と直交する軸における位置を指定。
    def to_a(axis, pos)
      {:vertical => lambda {
        (0...@height).map {|y| self[pos, y]}
       },
       :horizontal => lambda {
        (0...@width).map  {|x| self[x, pos]}
       },
      }[axis].call
    end

    # returns:: Array
    def hline(y)
      self.to_a(:horizontal, y)
    end

    # returns:: Array
    def vline(x)
      self.to_a(:vertical, x)
    end

    # X軸方向に画素を走査。
    # y:: どの位置で走査するか
    # returns:: 指定された軸の上にドットが存在: false, 無い: true
    def hline_blank?(y)
      hline(y).find {|color| color == BLACK }.nil? ?
        true : false
    end

    # Y軸方向に画素を走査。
    # x:: どの位置で走査するか
    # returns:: 指定された軸の上にドットが存在: false, 無い: true
    def vline_blank?(x)
      vline(x).find {|color| color == BLACK }.nil? ?
        true : false
    end

    # 上下のマージン削除した新しいPixelMatrixを返す。
    # returns:: PixelMatrix
    def cutoff_vmargin
      pixel = PixelMatrix.new(0, 0, true)
      head = 0.upto(self.height - 1) do |y|
        break(y) if !self.hline_blank?(y)
      end
      tail = (self.height - 1).downto(0) do |y|
        break(y) if !self.hline_blank?(y)
      end

      head.upto(tail) do |y|
        y0 = pixel.height
        self.hline(y).inject(0) do |x, color|
          pixel[x, y0] = color
          x + 1
        end
      end

      return pixel
    end
    
    def each_with_axis
      (0...@width).each {|x|
        (0...@height).each {|y|
          yield(x, y)}}
    end
  end
end

class DeCAPTCHA::Site::YourFileHost::Token
DIGITS_ASSOC = [
# 0
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],
 [0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0,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, 0],
 [0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
 [0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
]
end


__END__
Dir.glob('*.gif').each do |file|
  puts "Processing file: #{file}"
  p DeCAPTCHA.decode(file)
end

__END__

2007-05-24

http://anond.hatelabo.jp/20070523230747

プログラミングなんて、人に教わろうなんて思っちゃ駄目だぜ。師匠はいてもいい。人には、わからないところを聞くもんだぜ。プログラミングなんて習うより慣れろ、だぜ。

とりあえず、目に見える形が出るものをやってみるのが一番だぜ。昔なら、Basicマガジンゲームソースを打ち込んで、改造したけど、これって、目に見えて、変化するから、覚えられるんだぜ。

つまりだな、以下のプログラミング環境を触ってみるのがいいんだぜ。

とにかく、わからなくても、サンプルとかネットコードを弄ってみて、改造して、覚えるもんだぜ。


とりあえず、プログラミングに詳しいリアル友達がいなかったら、2ch初心者スレで聞きまくるんだぜ。聞くコツは、「初心者ですが、よろしくお願いします」なんてわかりきったこと言わないことだぜ。あとは、エラー内容とかは、詳細まで貼り付けることだぜ。

- 転職ならen
- 派遣ならen
 
1ページ中1ページ目を表示(合計:15件)