Monday, August 5, 2013

How to make your holidays in hiking in Morocco - YolBook.com

If you wish to enjoy your vacation with your family and friends in the most attractive point of the planet such as Morocco then rest assured not to miss the elite opportunity provided by Camel Trekking in Morocco. They offer an awesome walking and trekking opportunities to their clients.? From camel trekking to village hiking and ski touring one can choose to do any of these exciting activities.

The camel Trekking in Morocco is simply amazing. It is because they avail not only a luxurious traveling to Morocco but also a five star treatment to their guests. They render an eight day trip where a tourist settles and explores different places in Morocco. These include Marrakech, Faija, camping, Dunes of Chegaga, Dunes of Bougarne and Dunes of Oued Naam.

The essentialities that are provided to their guests in this trip is quite exotic like two nights in a three star hotel in Marrakech with breakfast, an optimal guide to mountain, comfortable transportation with a reliable and insured driver, delicious meals when nestled in trek tents, and provision of cooks, camels and cameleers during this trek. With this touring there is a unique exposure to ancient and modern traveling and discovering beautiful Saharian dunes at starry nights.

Moreover, one could have a relishing time in ski touring if he visits Morocco anytime in the months of February, March and April. This touring unveils him gorgeous mountains that are covered with snow and valleys that supply a genuine feel of trekking. The High Atlas towering peaks get unbelievably around 2000m snowfall in winter. Morocco is considered as a paradise for those who love skiing and snow climbing. This touring is accompanied with all accommodations, breakfasts and transportation with a driver.

Last but not least a traveler can as well opt for the village hiking. This kind of hiking is totally different and distinguished. No doubt, located in the northwestern tip of Africa, Morocco is one of the most beautiful and enchanting places that one can visit during his vacations. Additionally, Holidays in Morocco can be truly special if you give this team of the Sahara desert and mountain specialists a chance to serve you comprehensively.

Source: http://yolbook.com/article/travel-and-leisure-hiking-backpacking-topic/10486/how-to-make-your-holidays-in-hiking-in-morocco

rick perry iOS 7 Beta 3 Chris Kaman Tropical Storm Chantal amber rose andy murray Monica Wright

Court documents: Las Cruces man admits to credit union robbery, says he was suicidal

LAS CRUCES >> The man accused of robbing a credit union Wednesday admitted to the crime, telling an investigator that he was suicidal and hoped police would shoot and kill him inside the financial institution, according to a complaint filed Friday in federal court.

Dominic Holland, 26 of Las Cruces, told a Las Cruces Police officer and FBI task force agent that he robbed the First Light Federal Credit Union on Wednesday morning. He had passed a note to a teller, then ran out of the bank with nearly $5,000.

Holland's initial appearance is set for Monday in federal court. He is being held at the Do?a Ana County Detention Center.

While he was inside the credit union, Holland said, he talked to a college professor who recognized him. Holland asked the professor to leave because "something bad was going to happen," according to the complaint. The professor stayed, and Holland knew he would be caught, he told investigators.

Holland ran to a nearby apartment complex, where he had been known to stay. LCPD officers found him there, and authorities accounted for all the missing cash.


Source: http://www.lcsun-news.com/las_cruces-news/ci_23787136/court-documents-las-cruces-man-admits-credit-union?source=rss_viewed

grapes of wrath silent house nfl mock draft project m colts colts big ten tournament 2012

Jack White fires back at ex-wife in court docs

Music

2 hours ago

Jack White.

Jason Merritt / Getty Images file

Jack White.

Former White Stripes singer Jack White has provided an answer in court to his former wife Karen Elson, who had a restraining order issued against him last week and has petitioned that he submit to a psychiatric exam.

Rolling Stone obtained court documents from Davidson County Circuit Court in Nashville in which White objects to being characterized as an unfit father to their two children. In the countermotion, his lawyer Cathy Speers Johnson writes, "The reason for filing this response is that Mr. White does not want to be portrayed as something he is not, violent toward his wife and children."

The note also refers to emails the pair sent one another, including one dated May 19, 2013, where she calls him an "amazing father." The motion for a psychiatric exam is described as "inflammatory . . . . disingenuous, fraudulent and retaliatory and simply designed to malign him in the public record or to gain an upper hand in this litigation."

He said he did not oppose the restraining order, but objected to limited communication with his children.

White noted that Elson left the children in his care after signing the restraining order affidavit and then went on a "work/pleasure trip" in New York. "One who was truly fearful of another would not leave their children alone with that person for 10 days," the response noted. "The truth of the matter is that Ms. Elson is not fearful for herself or the parties' minor children."

In Elson's filing, she had referred to a musician White had particular enmity toward ? going so far as to wanting to have his child removed from a class where that musician's child was also taking part ? and White's countermotion revealed that the singer in question was The Black Keys' Dan Auerbach.?

In one email, writes?The Hollywood Reporter, White called Aeurbach a "derogatory name" and said he didn't want to spend the next 12 years of their children's schooling "with people trying to lump us together."

White's spokesperson told THR that he would only comment in court filings on the case, and Auerbach's spokesperson said he had no comment. Auerbach?is also going through a divorce, as announced in February.

Source: http://www.today.com/entertainment/jack-white-fires-back-ex-wife-court-documents-slams-black-6C10838307

daytona 500 national margarita day Ronda Rousey Cecil Hotel Cressida Bonas Kenny Clutch Edward Gorey

Northeastern Junior College students excel at state competition

Mike Schadegg of Wolf Auto, left, stands with Jonny Stahley and Mike Pomeroy in front of the training car he loaned them to train on before the Skills USA contest. (Courtesy photo)

Merino High School students Jonny Stahley and Mike Pomeroy, who were both enrolled in the Secondary Automotive Technology program at Northeastern Junior College this past spring, recently competed in the state-wide Skills USA contest.

Pomeroy placed 17th overall and Stahley placed 19th out of 35 competitors from all areas of Colorado. The two had previously placed at the top of the district contest to earn their way to the larger state competition.

In the state's Ford AAA contest, Stahley and Pomeroy as a team finished second overall in the written portion of the testing, out of 150 students. The duo placed sixth in the hands-on part of the contest. During the hands-on portion, experts deliberately put some "bugs" in the engine or other operating systems and it is up to the students to find out what is wrong with the car, working against time.

To help Stahley and Pomeroy prepare for the competition, Mike Schadegg from Wolf Auto in Sterling temporarily donated a 2013 Ford Focus to the college for the students to train on before they went to compete at the state level in mid-May in Denver. For many years, Wolf Auto and Jim Able from Ford AAA Colorado have supported the automotive programs at Northeastern with the donation of cars, advice, and other resources.

Source: http://www.journal-advocate.com/sterling-local_news/ci_23786015/northeastern-junior-college-students-excel-at-state-competition?source=rss_viewed

The Pope the Grammys 2013 State of the Union 2013 katy perry Rihanna Katy Perry Grammys 2013 Fun

M Pai MP-s720(S720c) MTK6572 Android 4.2.2 WCDMA Bar Phone w/ 4.5", FM and GPS - Black + Yellow

To enable volume discounts on this site, use coupon code: BULKRATE during checkout. You will see a discount applied at the bottom of the shopping cart. Competitive pricing is available. Contact us for details.

Quantity 3+ units 5+ units 10+ units
Rate USD$ 96.20 shipped USD$ 96.10 shipped USD$ 96.00 shipped

What is Bulk Rate? BulkRate is a semi-wholesale system with items priced separately from retail. When you use bulk rates, a flat $1.70 registered air mail fee will automatically be added to your cart to ensure delivery of package. While BulkRate's intention is to offer cheaper prices when you buy in bulk, because it is priced separately it on occassions show a higher than retail price. That's why we ask you to enter BULKRATE as a coupon code to manually activate the rates. You can always opt not to use the bulk rates. If you are looking for wholesale prices please feel free to contact us.

Looking to get even more?
Try VolumeRate - Gadgets Wholesale Or Contact Us Directly

Source: http://dx.com/p/m-pai-mp-s720-s720c-mtk6572-android-4-2-2-wcdma-bar-phone-w-4-5-fm-and-gps-black-yellow-233748

Zero Dark Thirty Academy Awards 2013 Django Unchained jennifer hudson jennifer garner jennifer garner daytona 500

Sunday, August 4, 2013

Disorder can improve the performance of plastic solar cells, Stanford scientists say

Disorder can improve the performance of plastic solar cells, Stanford scientists say [ Back to EurekAlert! ] Public release date: 4-Aug-2013
[ | E-mail | Share Share ]

Contact: Mark Shwartz
mshwartz@stanford.edu
650-723-9296
Stanford University

Scientists have spent decades trying to build flexible plastic solar cells efficient enough to compete with conventional cells made of silicon. To boost performance, research groups have tried creating new plastic materials that enhance the flow of electricity through the solar cell. Several groups expected to achieve good results by redesigning pliant polymers of plastic into orderly, silicon-like crystals, but the flow of electricity did not improve.

Recently, scientists discovered that disorder at the molecular level actually improves the polymers' performance. Now Stanford University researchers have an explanation for this surprising result. Their findings, published in the Aug. 4 online edition of the journal Nature Materials, could speed up the development of low-cost, commercially available plastic solar cells.

"People used to think that if you made the polymers more like silicon they would perform better," said study co-author Alberto Salleo, an associate professor of materials science and engineering at Stanford. "But we found that polymers don't naturally form nice, well-ordered crystals. They form small, disordered ones, and that's perfectly fine."

Instead of trying to mimic the rigid structure of silicon, Salleo and his colleagues recommend that scientists learn to cope with the inherently disordered nature of plastics.

Speedy electrons

In the study, the Stanford team focused on a class of organic materials known as conjugated or semiconducting polymers chains of carbon atoms that have the properties of plastic, and the ability to absorb sunlight and conduct electricity.

Discovered nearly 40 years ago, semiconducting polymers have long been considered ideal candidates for ultrathin solar cells, light-emitting diodes and transistors. Unlike silicon crystals used in rooftop solar panels, semiconducting polymers are lightweight and can be processed at room temperature with ink-jet printers and other inexpensive techniques. So why aren't buildings today covered with plastic solar cells?

"One reason they haven't been commercialized is because of poor performance," Salleo said. "In a solar cell, electrons need to move through the materials fast, but semiconducting polymers have poor electron mobility."

To find out why, Salleo joined Rodrigo Noriega and Jonathan Rivnay, who were Stanford graduate students at the time, in analyzing more than two decades of experimental data. "Over the years, many people designed stiffer polymers with the goal of making highly organized crystals, but the charge mobility remained relatively poor," Salleo said. "Then several labs created polymers that looked disordered and yet had very high charge mobility. It was a puzzle why these new materials worked better than the more structured crystalline ones."

X-ray analysis

To observe the disordered materials at the microscopic level, the Stanford team took samples to the SLAC National Accelerator Laboratory for X-ray analysis. The X-rays revealed a molecular structure resembling a fingerprint gone awry. Some polymers looked like amorphous strands of spaghetti, while others formed tiny crystals just a few molecules long.

"The crystals were so small and disordered you could barely infer their presence from X-rays," Salleo said. "In fact, scientists had assumed they weren't there."

By analyzing light emissions from electricity flowing through the samples, the Stanford team determined that numerous small crystals were scattered throughout the material and connected by long polymer chains, like beads in a necklace. The small size of the crystals was a crucial factor in improving overall performance, Salleo said.

"Being small enables a charged electron to go through one crystal and rapidly move on to the next one," he said. "The long polymer chain then carries the electron quickly through the material. That explains why they have a much higher charge mobility than larger, unconnected crystals."

Another disadvantage of large crystalline polymers is that they tend to be insoluble and therefore cannot be produced by ink-jet printing or other cheap processing technologies, he added.

"Our conclusion is that you don't need to make something so rigid that it forms large crystals," Salleo said. "You need to design something with small, disordered crystals packed close together and connected by polymer chains. Electrons will move through the crystals like on a superhighway, ignoring the rest of the plastic material, which is amorphous and poorly conducting.

"In some sense, the synthetic chemists were ahead of us, because they made these new materials but didn't know why they worked so well," he said. "Now that they know, they can go out and design even better ones."

And Salleo offered a final piece of advice. "Try to design a material that can live with as much disorder as possible," he said. "Take the disorder for granted. Personally, I really like disorder. Just look at my office."

###

Other authors of the study are postdoctoral scholar Koen Vandewal of Stanford; Felix Koch and Paul Smith of ETH Zurich; Natalie Stingelin of Imperial College London; and Michael Toney of the SLAC Stanford Synchrotron Radiation Lightsource.

The study was supported by a Stanford Center for Advanced Molecular Photovoltaics award from the King Abdullah University of Science and Technology; and by the European Research Council.

This article was written by Mark Shwartz of the Precourt Institute for Energy at Stanford University.

Comment:

Alberto Salleo, Department of Materials Science and Engineering: (650) 725-1025, asalleo@stanford.edu


[ Back to EurekAlert! ] [ | E-mail | Share Share ]

?


AAAS and EurekAlert! are not responsible for the accuracy of news releases posted to EurekAlert! by contributing institutions or for the use of any information through the EurekAlert! system.


Disorder can improve the performance of plastic solar cells, Stanford scientists say [ Back to EurekAlert! ] Public release date: 4-Aug-2013
[ | E-mail | Share Share ]

Contact: Mark Shwartz
mshwartz@stanford.edu
650-723-9296
Stanford University

Scientists have spent decades trying to build flexible plastic solar cells efficient enough to compete with conventional cells made of silicon. To boost performance, research groups have tried creating new plastic materials that enhance the flow of electricity through the solar cell. Several groups expected to achieve good results by redesigning pliant polymers of plastic into orderly, silicon-like crystals, but the flow of electricity did not improve.

Recently, scientists discovered that disorder at the molecular level actually improves the polymers' performance. Now Stanford University researchers have an explanation for this surprising result. Their findings, published in the Aug. 4 online edition of the journal Nature Materials, could speed up the development of low-cost, commercially available plastic solar cells.

"People used to think that if you made the polymers more like silicon they would perform better," said study co-author Alberto Salleo, an associate professor of materials science and engineering at Stanford. "But we found that polymers don't naturally form nice, well-ordered crystals. They form small, disordered ones, and that's perfectly fine."

Instead of trying to mimic the rigid structure of silicon, Salleo and his colleagues recommend that scientists learn to cope with the inherently disordered nature of plastics.

Speedy electrons

In the study, the Stanford team focused on a class of organic materials known as conjugated or semiconducting polymers chains of carbon atoms that have the properties of plastic, and the ability to absorb sunlight and conduct electricity.

Discovered nearly 40 years ago, semiconducting polymers have long been considered ideal candidates for ultrathin solar cells, light-emitting diodes and transistors. Unlike silicon crystals used in rooftop solar panels, semiconducting polymers are lightweight and can be processed at room temperature with ink-jet printers and other inexpensive techniques. So why aren't buildings today covered with plastic solar cells?

"One reason they haven't been commercialized is because of poor performance," Salleo said. "In a solar cell, electrons need to move through the materials fast, but semiconducting polymers have poor electron mobility."

To find out why, Salleo joined Rodrigo Noriega and Jonathan Rivnay, who were Stanford graduate students at the time, in analyzing more than two decades of experimental data. "Over the years, many people designed stiffer polymers with the goal of making highly organized crystals, but the charge mobility remained relatively poor," Salleo said. "Then several labs created polymers that looked disordered and yet had very high charge mobility. It was a puzzle why these new materials worked better than the more structured crystalline ones."

X-ray analysis

To observe the disordered materials at the microscopic level, the Stanford team took samples to the SLAC National Accelerator Laboratory for X-ray analysis. The X-rays revealed a molecular structure resembling a fingerprint gone awry. Some polymers looked like amorphous strands of spaghetti, while others formed tiny crystals just a few molecules long.

"The crystals were so small and disordered you could barely infer their presence from X-rays," Salleo said. "In fact, scientists had assumed they weren't there."

By analyzing light emissions from electricity flowing through the samples, the Stanford team determined that numerous small crystals were scattered throughout the material and connected by long polymer chains, like beads in a necklace. The small size of the crystals was a crucial factor in improving overall performance, Salleo said.

"Being small enables a charged electron to go through one crystal and rapidly move on to the next one," he said. "The long polymer chain then carries the electron quickly through the material. That explains why they have a much higher charge mobility than larger, unconnected crystals."

Another disadvantage of large crystalline polymers is that they tend to be insoluble and therefore cannot be produced by ink-jet printing or other cheap processing technologies, he added.

"Our conclusion is that you don't need to make something so rigid that it forms large crystals," Salleo said. "You need to design something with small, disordered crystals packed close together and connected by polymer chains. Electrons will move through the crystals like on a superhighway, ignoring the rest of the plastic material, which is amorphous and poorly conducting.

"In some sense, the synthetic chemists were ahead of us, because they made these new materials but didn't know why they worked so well," he said. "Now that they know, they can go out and design even better ones."

And Salleo offered a final piece of advice. "Try to design a material that can live with as much disorder as possible," he said. "Take the disorder for granted. Personally, I really like disorder. Just look at my office."

###

Other authors of the study are postdoctoral scholar Koen Vandewal of Stanford; Felix Koch and Paul Smith of ETH Zurich; Natalie Stingelin of Imperial College London; and Michael Toney of the SLAC Stanford Synchrotron Radiation Lightsource.

The study was supported by a Stanford Center for Advanced Molecular Photovoltaics award from the King Abdullah University of Science and Technology; and by the European Research Council.

This article was written by Mark Shwartz of the Precourt Institute for Energy at Stanford University.

Comment:

Alberto Salleo, Department of Materials Science and Engineering: (650) 725-1025, asalleo@stanford.edu


[ Back to EurekAlert! ] [ | E-mail | Share Share ]

?


AAAS and EurekAlert! are not responsible for the accuracy of news releases posted to EurekAlert! by contributing institutions or for the use of any information through the EurekAlert! system.


Source: http://www.eurekalert.org/pub_releases/2013-08/su-dci080113.php

ups Aj Mccarron Girlfriend CES 2013 joe budden notre dame notre dame football Bcs Bowl

Parade marks festive start to Puerto Rican celebration

Sorry, Readability was unable to parse this page for content.

Source: http://www.democratandchronicle.com/article/20130803/NEWS01/308030034/1103/RSS09

gawker Romney Bosses Day 2012 Arlen Specter Winsor McCay Amanda Todd washington nationals

Ledecky wins 4th gold, set another WR at worlds

Katie Ledecky of the United States swims to the gold medal in the Women's 800m freestyle final at the FINA Swimming World Championships in Barcelona, Spain, Saturday, Aug. 3, 2013. (AP Photo/David J. Phillip)

Katie Ledecky of the United States swims to the gold medal in the Women's 800m freestyle final at the FINA Swimming World Championships in Barcelona, Spain, Saturday, Aug. 3, 2013. (AP Photo/David J. Phillip)

Katie Ledecky of the United States, right, New Zealand's Lauren Boyle, left, compete in the Women's 800m freestyle final at the FINA Swimming World Championships in Barcelona, Spain, Saturday, Aug. 3, 2013. Ledecky took the gold medal. (AP Photo/David J. Phillip)

Katie Ledecky of the United States swims to the gold medal in the Women's 800m freestyle final at the FINA Swimming World Championships in Barcelona, Spain, Saturday, Aug. 3, 2013. (AP Photo/David J. Phillip)

BARCELONA, Spain (AP) ? Katie Ledecky capped a brilliant world swimming championships with her fourth gold medal and second world record Saturday.

The 16-year-old American turned it on over the final laps to win the 800-meter freestyle in 8 minutes, 13.86 seconds. She powered to the wall like it was a sprint, not the last of 16 laps.

Lotte Friis of Denmark set the early pace but simply couldn't keep up when Ledecky turned it on, a repeat of their race in the 1,500 where the teenager broke the previous record by more than 6 seconds.

This time, Ledecky took down the mark of 8:14.10 set by Britain's Rebecca Adlington at the 2008 Olympics. Friis settled for another silver, and New Zealand's Lauren Boyle claimed the bronze ? the same order as in the 1,500.

Associated Press

Source: http://hosted2.ap.org/APDEFAULT/347875155d53465d95cec892aeb06419/Article_2013-08-03-SWM-Swim-Worlds/id-b47370352c844f2ea11f5e251a9274e7

Ashton Eaton London 2012 basketball London 2012 Slalom Canoe Alex Morgan Misty May Treanor Marvin Hamlisch Megan Rossee

Warmist Suzanne Goldenberg after taking an unnecessary fossil-fueled flight to Greenland: "Hard to go coach after LC-130"

Tom Nelson: Warmist Suzanne Goldenberg after taking an unnecessary fossil-fueled flight to Greenland: "Hard to go coach after LC-130" skip to main | skip to sidebar

Warmist Suzanne Goldenberg after taking an unnecessary fossil-fueled flight to Greenland: "Hard to go coach after LC-130"

?

Source: http://tomnelson.blogspot.com/2013/08/warmist-suzanne-goldenberg-after-taking.html

unlv sam young ramon sessions portland trail blazers blagojevich new mexico state kevin rose

After airport exit, what will Edward Snowden do in Russia?

A local social network has offered him a job. Meanwhile, the decision to grant him asylum is still rattling US-Russia relations.?

By Fred Weir,?Correspondent / August 1, 2013

Russian lawyer Anatoly Kucherena shows a temporary document to allow Edward Snowden, his client, to cross the border into Russia. Mr. Snowden has left the Moscow airport where he has been stranded for weeks and entered Russia on a one-year grant of asylum.

Russia24/AP

Enlarge

Former National Security Agency contractor Edward Snowden has been granted a year's political asylum in Russia. He has left Sheremetyevo airport and will remain in an "undisclosed location" for at least a day, according his lawyer Anatoly Kucherena.

Skip to next paragraph Fred Weir

Correspondent

Fred Weir has been the Monitor's Moscow correspondent, covering Russia and the former Soviet Union, since 1998.?

Recent posts

' + google_ads[0].line2 + '
' + google_ads[0].line3 + '

'; } else if (google_ads.length > 1) { ad_unit += ''; } } document.getElementById("ad_unit").innerHTML += ad_unit; google_adnum += google_ads.length; return; } var google_adnum = 0; google_ad_client = "pub-6743622525202572"; google_ad_output = 'js'; google_max_num_ads = '1'; google_feedback = "on"; google_ad_type = "text"; // google_adtest = "on"; google_image_size = '230x105'; google_skip = '0'; // -->

Russian news agencies showed pictures of someone who might have been Mr. Snowden climbing into a car at Sheremetyevo airport?Thursday afternoon, though no Western reporters witnessed any part of his passage through passport control and departure from the airport ? where he has spend almost 7 weeks apparently cooped up in a "capsule hotel"?in the legal limbo of the vast transit zone.

On Snowden's immediate agenda is a phone call from his father, which Mr. Kucherena said would be set up today, and some rather heavy contemplation about his future. Kucherena told journalists that the passport-like temporary asylum document he's been issued will enable him to travel freely around Russia, rent accommodation, and even find a job.?

And he even has a job offer to think about already. The Russian-language social network VKontakte, which is similar to Facebook, announced?Thursday?that he could come and work with them ? presumably to help shield the network from NSA snooping.

"We invite Edward to St. Petersburg [where VKontakte is based] and will be delighted if he decides to complete VKontakte's star team of programmers," the organization's founder, Pavel Durov, wrote on his VKontakte page.

Snowden "might be interested in working on protecting the personal data of millions of our users.... Today, Edward Snowden, a person who exposed the crimes of the American special services against citizens of the entire world, has received temporary asylum in Russia. At such moments, you feel pride for our country and sorrow over the course of the USA, a country betraying the principles on which it was built," Mr. Durov added.

He also has an outstanding invitation from the Federation Council, Russia's upper house of parliament, to come and testify about how the spying programs he revealed might impact Russian users of big Internet companies like Yahoo, Google, Microsoft, Apple, and Facebook.

WikiLeaks, the anti-secrecy organization that's been sponsoring Snowden's flight, posted a lengthy statement?thanking Russia and trumpeting what it called a "victory in the fight against Obama?s war on whistleblowers. This battle has been won, but the war continues."

It also praised Sarah Harrison, the WikiLeaks official who accompanied Snowden on his?June 23?flight from Hong Kong and has remained with him through the 39 days of his stay in Sheremetyevo.?

"Ms. Harrison has remained with Mr. Snowden at all times to protect his safety and security, including during his exit from Hong Kong. They departed from the airport together in a taxi and are headed to a secure, confidential place," it said.

In Washington, news of Snowden's asylum grant in Russia was greeted with dismay.

"We see this as an unfortunate development and we are extremely disappointed by it," White House spokesman Jay Carney told journalists. He suggested that President Obama's plans to meet with President Vladimir Putin before a G20 summit in St. Petersburg that's barely a month off might be in jeopardy.? "We are evaluating the utility of the summit in light of this," news agencies quoted him as saying.

"We made clear both privately and publicly that there was ample legal justification for his expulsion from Russia and return to the United States, that's a discussion we've had with Russia as well as with other countries that might have been considering providing asylum to Mr. Snowden," Mr. Carney added.?

Several United States Senators have also warned that the Snowden case could do irreparable harm to the already-frayed relationship between the US and Russia.

However, Mr. Putin's close aide and reputed foreign policy architect Yury Ushakov told journalists he does not expect any serious fallout from the decision.

"This issue is not important enough to affect political relations," the official RIA-Novosti agency quoted Mr. Ushakov as saying.

Alexei Arbatov, a leading Russian foreign policy expert, says he believes the international ill-will surrounding the Snowden case will blow over.

"The Snowden issue might have domestic complications in the US, meaning that opposition will attack Obama [for mishandling the affair]. But on the international level it's just not sufficient reason to make the US and Russia quarrel seriously. I do not believe that the important economic and political issues on the US-Russia bilateral agenda will suffer because of the very questionable actions of this young man," he says.

Kucherena, the lawyer, told journalists that his client needed at least a day to clear his head, but might be available to talk to media as early as?Friday.

"Of course, he will come. He is aware that mass media is interested in him. But in this case, the situation is such for now," he said, apparently meaning that his client would not be speaking not anytime soon.

He also contradicted reports that Snowden might have shared some of the secrets he reputedly holds in the four laptop computers he carries with him everywhere.

"I can absolutely say that he did definitely not pass on any documents to anybody here at the Sheremetyevo airport. That is, the documents that were published yesterday are documents that he handed over [to The Guardian] while still in Hong Kong," Kucherena said on Rossiya 24 news television channel.

He was referring to a sweeping expos? published Wednesday in the Guardian,?based on documents provided by Snowden about an NSA tool known as XKeyscore,?which allegedly enables the agency to scoop up "nearly everything a user does on the Internet." ? ? ??

Snowden has "given his word and promised to stop the whistleblowing activity aimed at United States" and can be trusted to keep it, Kucherena said.

Kucherena, who has been Snowden's main spokesman during the long stay in Sheremetyevo, told journalists his client would undergo a period of "acclimatization," including studying Russian language, law, customs, and literature. The lawyer also said he would remain involved with Snowden in an advisory capacity.

"[Snowden] is the most wanted person on earth and his security will be a priority," Kucherena said. "He will deal with personal security issues and lodging himself. I will just consult him as his lawyer."

Experts say it's likely that Snowden will be kept under tough restraints by Russia's FSB security service in pursuance of President Vladimir Putin's oft-repeated pledge that he will not be allowed to harm US interests while he remains in Russia. That suggests that he may be as isolated from journalists in his new location as he was during the nearly seven weeks he spent hiding out in Sheremetyevo's transit zone.

His release comes just a day after his father appeared for the first time on Russian TV to thank Mr. Putin "for keeping my son safe" and to hope that Russia will take him in and accept him until such time as he can find safe haven somewhere else.

It also comes on the same day a Russian public opinion poll showed that just over half of Russians regard Snowden as a "hero"?while just 17 percent were "negative" toward his actions. On the other hand, the poll found that only 43 percent supported giving him asylum in Russia, while 29 percent were against it to some degree.?

WikiLeaks quoted Snowden as heading into his new life in Russia defiant and, perhaps, just a little bit jubilant.

"Over the past eight weeks we have seen the Obama administration show no respect for international or domestic law, but in the end the law is winning. I thank the Russian Federation for granting me asylum in accordance with its laws and international obligations," Snowden is quoted as saying.

Source: http://rss.csmonitor.com/~r/csmonitor/globalnews/~3/9fBXkRRqpz0/After-airport-exit-what-will-Edward-Snowden-do-in-Russia

rod stewart derrick rose lena horne klay thompson kate upton the great gatsby the great gatsby

Saturday, August 3, 2013

Real-time camera effects on Windows Phone 7 and 8


Revision as of 16:05, 2 August 2013

This article explains how to efficiently read a live stream from the camera on Windows Phone 7 and 8 devices and how to apply an effect filter on this stream.

Article Metadata

Code Example
Tested with

SDK: Windows Phone 7.1 SDK, Windows Phone 8.0 SDK

Devices(s): Nokia Lumia 800, Samsung Omnia 7, Nokia Lumia 720, HTC 8X


Compatibility
Platform Security

Capabilities: ID_CAP_ISV_CAMERA


Article

Introduction

Most of the photo apps on the market are pretty simple. They allow users to take a photo, then apply some interesting vintage filter and save the photo. But only a few applications have a true live viewfinder with a real-time applied filter. Would it be nice to see how the photo will look like, even before you press the shutter button? What about some other live effects like a pixelated 8-bit style screen?

We will show you in this article how to make an app (in C# language) that can run on both Windows Phone 7 and Windows Phone 8 devices. Our goal will be to design a sufficiently fast implementation that can run flawlessly even on the oldest and slowest devices. We will go through several ideas and implementations and we will compare them.

The main ideas

  • We will use a VideoBrush component at first. We will demonstrate its limitations.
  • We will read ARGB values directly from the camera, and see how this values can be efficiently packed and unpacked.
  • We will discover a faster solution (reading values from the YCbCr buffer).
  • We will discuss how to make this processing even better (to work with a smaller resolution).
  • We will see an idea how to make an interesting 8-bit style photo app based on these methods.


We will be demonstrating these methods on the Windows Phone 7 (WP7) project. In the last chapter we will cover the differences between WP7 and Windows Phone 8 (WP8):

  • We will see how to use this approach on WP8 (thanks to MonoGame Framework)
  • We will compare all methods and measure the rendering time

VideoBrush component

The simplest solution for showing a direct stream from the camera is the VideoBrush API. The code is the same on WP7 and WP8. You can add this code into your XAML page:

<Rectangle Width="320" Height="320">
<Rectangle.Fill>
<VideoBrush x:Name="viewfinderBrush" />
</Rectangle.Fill>
</Rectangle>

In the code-behind you can initialize the camera object, using PhotoCamera class and set the stream to the VideoBrush:

PhotoCamera camera;
?
protected override void OnNavigatedTo(NavigationEventArgs e)
{
// Initialize a camera object, set stream to the VideoBrush
camera = new PhotoCamera();
viewfinderBrush.SetSource(camera);
}
?
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
{
camera.Dispose();
}

Do not forget to add an ID_CAP_ISV_CAMERA capability. This is a very simple solution. The stream from the camera is quite distorted and wrongly rotated, but you can fix this by setting a RelativeTransform on the Rectangle. But what is a real pity, you can't modify this stream in any way. You can't apply any filter or effect on the VideoBrush object, you don't have an access to the raw data of the pixels.

Reading from the buffer

We will use a different approach. As you can discover, there are some GetPreviewBuffer methods on the PhotoCamera object. This is the way how we can get the raw data from the camera. But we would like also to display this data somewhere, in some fast and efficient way. WritableBitmap component from the Silverlight is very slow, writing data pixel by pixel using this component can take a hundreds of milliseconds. We will need to find another solution.

We will create a new combined Silverlight/XNA project for Windows Phone 7 (we will talk about WP8 later). We would like to combine the ease of XAML and Silverlight with the power of the XNA in one solution. We will use a very similar approach to one described in the article Use Camera with XNA.

You need to have installed a Windows Phone SDK 7.1. Open your Visual Studio 2010 (Express or the Professional/Ultimate) and create a new Windows Phone Silverlight and XNA Application project.

New xnasilverlight project.png

To be able to read from the camera we need to place a fake Canvas to our XAML code. Add to GamePage.xaml page this line of code:

<Canvas x:Name="cameraDisplayFake" Width="0" Height="0"></Canvas>

We will create a helper object now. Let's create a new class CamReader.cs and place into it these declarations:

PhotoCamera camera;
int[] previewBuffer, outputBuffer;
Point previewSize, outputSize;

As you can see, there is some preview buffer and the output buffer. The preview buffer will contain the raw values from the camera and will be usually 640x480 pixels big. Applying effects on this large resolution would be very resource intensive and slow. We do not need such a big resolution for the live preview. Our output buffer will be smaller, for example only 240x240 px. All computations and filter calculations will be executed on this smaller resolution. We can scale up this image later, it will be a little blurred, but that does not matter much for us.

This is how the CamReader.StartCamera method can look like:

public void StartCamera(Dispatcher dispatcher, Canvas fakeCamCanvas, Point outputSize)
{
this.outputSize = outputSize;
?
if (camera != null)
StopCamera(fakeCamCanvas);
?
// Create a PhotoCamera instance
if (PhotoCamera.IsCameraTypeSupported(CameraType.Primary))
camera = new PhotoCamera(CameraType.Primary);
else if (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing))
camera = new PhotoCamera(CameraType.FrontFacing);
else
{
System.Windows.MessageBox.Show("Cannot find a camera on this device");
return;
}
?
// Wait camera initialization before create the buffer image
camera.Initialized += (a, b) =>
{
// Move to UI thread
dispatcher.BeginInvoke(() =>
{
outputBuffer = new int[outputSize.X * outputSize.Y];
previewSize = new Point((int)camera.PreviewResolution.Width, (int)camera.PreviewResolution.Height);
previewBuffer = new int[previewSize.X * previewSize.Y];
}
);
};
?
// Initialize camera
// - we need to initialize VideoBrush to given Canvas, otherwise the stream wouldn't be loaded
var brush = new VideoBrush();
brush.SetSource(camera);
fakeCamCanvas.Background = brush;
}

Reading ARGB data

Now we can design a method for reading ARGB data from the camera:

public int[] GetBufferFromARGB()
{
if (camera != null && previewBuffer != null)
{
// Get preview Image buffer (640x480)
try { camera.GetPreviewBufferArgb32(previewBuffer); }
catch { return null; }
?
// Select outputBuffer pixels (outputSize = smaller than 640x480 preview pixels)
CopyValuesToOutputBuffer();
?
// Swap Red and Blue channel (Silverlight -> XNA's texture)
SwapRedBlueChannel(outputBuffer);
return outputBuffer;
}
return null;
}

This method retrieves the data from the camera to preview buffer (640x480). Then the selected values are copied to the smaller output buffer (see the next paragraph for the method implementation). Output colors are swapped to correct XNA's Texture2D format and finally the output buffer is returned.

The output buffer is a linear array of integer values. Every integer has the compressed info about the whole RGB value of the pixel and its alpha (transparency). In the field outputSize we have the X and Y size of the output image.

Helper methods

The first method is used to copy values from the preview to output buffer. Here you can find quite a complex variant. This implementation automatically crops the image by the correct output ratio. The image is also auto-rotated and scaled.

private void CopyValuesToOutputBuffer()
{
// Copies data from preview buffer (640x480) to smaller output buffer in correct ratio
Point start = Point.Zero, incr = Point.Zero;
GetOutputParams(ref start, ref incr);
?
// Inserts values to the output buffer
for (int y = 0; y < outputSize.Y; y++)
for (int x = 0; x < outputSize.X; x++)
{
// Auto flip / rotate the image to output
int sourceX = Math.Min(start.X + y * incr.X, previewSize.X - 1);
int sourceY = Math.Min(previewSize.Y - (start.Y + x * incr.Y) - 1, previewSize.Y - 1);
int i = sourceX + sourceY * previewSize.X;
outputBuffer[x + y * outputSize.X] = previewBuffer[i];
}
}
private void GetOutputParams(ref Point start, ref Point incr)
{
// Returns correct params for the output buffer
// = start index & increment, how should we read from the preview buffer
start = Point.Zero;
incr = new Point(previewSize.X / outputSize.Y, previewSize.Y / outputSize.X);
?
if (previewSize.X / (float)previewSize.Y > outputSize.Y / (float)outputSize.X)
{
// Preview is wider, output buffer will be cropped at left/right side
start.X = (int)((previewSize.X - outputSize.Y * previewSize.Y / (float)outputSize.X) / 2);
incr.X = (previewSize.X - 2 * start.X) / outputSize.Y;
}
else
{
// Output buffer is wider (preview is taller, crop at top/bottom)
start.Y = (int)((previewSize.Y - outputSize.X * previewSize.X / (float)outputSize.Y) / 2);
incr.Y = (previewSize.Y - 2 * start.Y) / outputSize.X;
}
}

Note:?We are using the integer division for calculating the increment (for performance reasons). This will work fine if the output buffer is sufficiently smaller than the camera preview. If the output and preview sizes are almost similar, this method may give you poor results.

Note:?You can find a new object for reading from the camera in the WP8 API: PhotoCaptureDevice. It is possible to set there a preview size of the buffer directly (so you do not need to call this method anymore). Unfortunately this API is not available for older WP7 devices.


The next method converts the image buffer into XNA format:

private void SwapRedBlueChannel(int[] buffer)
{
for (int i = 0; i < buffer.Length; ++i)
{
// Converts a packed RGB integer value from Silverlight's to XNA format
// - we need to switch a red and blue channel
buffer[i] = (int)((uint)buffer[i] & 0xFF00FF00)
| (buffer[i] >> 16 & 0xFF)
| (buffer[i] & 0xFF) << 16;
}
}

And finally, we should include to our CamReader class the method for stopping the camera. It will be called when we leave the app, or when the app was switched to background:

public void StopCamera(Canvas fakeCamCanvas)
{
if (camera != null)
camera.Dispose();
camera = null;
previewBuffer = null;
fakeCamCanvas.Background = null;
}

Rendering the live stream

Now we have prepared a helper class CamReader.cs. We would like to integrate this logic into our app.

Let's open a GamePage.xaml.cs file. This is the place where we can write the code for the XNA Framework.

Add these declarations to this file:

Point outputSize;
CamReader camReader;
Texture2D texture;

And add this inicialization logic to method OnNavigatedTo:

protected override void OnNavigatedTo(NavigationEventArgs e)
{
//...
// Initialize the camera reader + XNA's texture (of the correct size)
GraphicsDevice device = SharedGraphicsDeviceManager.Current.GraphicsDevice;
outputSize = new Point(240, 240);
texture = new Texture2D(device, outputSize.X, outputSize.Y);
?
camReader = new CamReader();
camReader.StartCamera(this.Dispatcher, cameraDisplayFake, outputSize);
//...
}

Our CamReader object and the texture will be initialized. Note that we are passing a cameraDisplayFake object to our StartCamera method. This is the one component that we have already added into our XAML code.

We can insert a similar logic into OnNavigatedFrom:

protected override void OnNavigatedFrom(NavigationEventArgs e)
{
camReader.StopCamera(cameraDisplayFake);
//...
}

Now we can finally render our photo stream on the display! Method OnDraw is called 30 times per second by default. We obtain a data from CamReader object every frame, then copy this data to the texture and draw this texture.

private void OnDraw(object sender, GameTimerEventArgs e)
{
GraphicsDevice device = SharedGraphicsDeviceManager.Current.GraphicsDevice;
device.Clear(Color.CornflowerBlue);
?
// Get camera values, draw image directly on screen by SpriteBatch (by converting into Texture2D)
int[] buffer = camReader.GetBufferFromARGB();
if (buffer != null)
{
//ApplyEffect(buffer, outputSize, effect); // Applies special filter on image
device.Textures[0] = null;
texture.SetData<int>(buffer);
?
spriteBatch.Begin();
spriteBatch.Draw(texture, new Vector2(0, 0), Color.White);
spriteBatch.End();
}
}

Note:?We can change the interval of the drawing loop from standard 30 frames per second (FPS) to a different value. You only need to change the timer.UpdateInterval in the GamePage contructor into TimeSpan.FromTicks(166666); and the rendering will run at amazing 60 FPS!

Note:?We can combine a XAML code (Silverlight) and the XNA content on one page together. XAML elements can be rendered into texture and displayed even over the content from the XNA. Similar situation is on the WP8, C#/XAML content can be also combined with MonoGame Framework at one page.

Working with image data

XNA is a very powerful framework for manipulating with images. In this sample we are drawing the texture on a point 0,0 (into the upper left corner), in 100% zoom. We can easily change the rendering code to draw this image two times bigger (= in 200% zoom):

spriteBatch.Draw(texture, Vector2.Zero, null, Color.White, 0f, Vector2.Zero,
2f, SpriteEffects.None, 0);

For this texture - we can also set the scale, the rotation, transparency. Before we convert our buffer into the texture, we can also apply any special filter on these data, for example: grayscale, sepia, lomo, vintage... Anything what we can imagine.

8-bit style renderer

So, we have a raw data from the camera. We do not need to convert them to the texture directly. We can work with this values and, for example, we can draw an extra image for every pixel!

We can make an interesting 8-bit looking app with a real live preview. The power of the XNA Framework will handle it (the slowest Windows Phones can draw around 120x120 non-transparent textures at once, in more than 20 FPS).

This 8-bit effect can look like this:

8bit live effect demonstration mini.png

Note:?These sample images have been generated with some advanced filters. Colors were restricted to a limited palette (for example only 16 specific colors) with a specified threshold. Variants of the Ordered Dithering and Floyd-Steinberg algorithm were applied.

Rendering pixels from images

We will show here the most simple version of this 8-bit renderer. Every pixel obtained from the camera will be drawn as a small image, colored with the RGB data. For example - our sample image will be 6x6 pixels big. If we set the output buffer of the camera to 80x80 pixels, the final image will be 480x480 px big.

You can download the sample image here: Sample sprite.png

And add this image to your Content project:

Xna content2.png

Now we can load this image into our app. Add to your GamePage.xaml.cs this declaration:

Modify the OnNavigated method like this:

protected override void OnNavigatedTo(NavigationEventArgs e)
{
//...
// Initialize the camera reader + small Sprite texture
sprite = contentManager.Load<Texture2D>("sample_sprite");
outputSize = new Point(80, 80);
camReader = new CamReader();
camReader.StartCamera(this.Dispatcher, cameraDisplayFake, outputSize);
//...
}

The image will be loaded to the sprite variable.

Note:?We are using a standard XNA Content pipeline, the image is converted to the uncompressed .xnb file, then loaded into the texture. We can also load this image directly from .png file.

Now we can draw the values. Modify the OnDraw method like this:

private void OnDraw(object sender, GameTimerEventArgs e)
{
//...
// Get camera values, draw image
int[] buffer = camReader.GetBufferFromARGB();
if (buffer != null)
{
// Draw a pixelated 8-bit effect
spriteBatch.Begin();
Draw8BitStyle(spriteBatch, buffer);
spriteBatch.End();
}
}

Our method Draw8BitStyle will simply read the values from the buffer, extract the color data and draw the sprite for every pixel:

private void Draw8BitStyle(SpriteBatch spriteBatch, int[] buffer)
{
// Draw a pixelated 8-bit effect from the buffer
for (int y = 0; y < outputSize.Y; y++)
for (int x = 0; x < outputSize.X; x++)
{
int val = buffer[y * outputSize.X + x];
?
// Convert value into color, draw the sprite
int a = val >> 24;
int b = (val & 0x00ff0000) >> 16;
int g = (val & 0x0000ff00) >> 8;
int r = (val & 0x000000ff);
?
Vector2 position = new Vector2(x * sprite.Width, y * sprite.Height);
spriteBatch.Draw(sprite, position, new Color(r, g, b));
}
}

Our live camera stream will look like this now. This is awesome!

8bit effect.png

Tip: If you want to know how to convert RGB values back into one integer value, this method will help you:

private int PackRGBValue(byte r, byte g, byte b)
{
// Pack individual RGB components into one single integer
uint output = 0xff000000; // Alpha
output |= (uint)b;
output |= (uint)(g << 8);
output |= (uint)(r << 16);
return unchecked((int)output);
}

Note:?You can find both variants of the algorithm in the attached sample project. The component for measuring frames per second (FPS) from the XNA is also attached.

Reading from the YCbCr buffer

Our photo stream from the camera looks great. But it's still not perfect. This implementation is horribly slow on the first generation of Windows Phone devices. For example on the Samsung Omnia 7 Device, the 120x120 pixels large scene composed of 4x4 px sprites runs only at 6 FPS! Can we fix it?

Fortunately there is a second method on the PhotoCamera object for reading raw values from the camera: GetPreviewBufferYCbCr. It is little more complicated to use, but gives us much better results. The main difference between these methods is - when we read an ARGB data from the camera, the whole 640x480 buffer is internally converted into RGB values. It doesn't matter that we wanted only a 120x120 px small array. All values had to be converted.

Method GetPreviewBufferYCbCr returns a buffer from the camera in the "more raw" format. We will convert to RGB values only those pixels that we really want. I can reveal you in advance that this implementation will run on the Samsung Omnia 7 Device faster than 20 FPS!

Note:?Do not worry about Nokia Lumia product line. Both implementations are sufficiently fast even on the Nokia Lumia 710 or 800 Device. The ARGB method runs at a stable 15 FPS, the YCbCr method runs at 22 FPS.

Note:?Windows Phone 8 devices will be even faster, on the Windows Phone 8X Device by HTC the ARGB method runs at 27 FPS and the faster YCbCr method is attacking 30 FPS (we are talking about WP7 application in a compatible mode, the native WP8 solution will be discussed in the last chapter of this article).

Implementation

We will extend our CamReader class. Add here these declarations:

// Special buffer for the YCbCr reader
YCbCrPixelLayout bufferLayout;
byte[] yCbCrPreviewBuffer;

The StartCamera method will also be slightly modified. Add these initialization logic to the dispatcher.BeginInvoke() call:

// Buffer initialization for reading from the YCbCr buffer
bufferLayout = camera.YCbCrPixelLayout;
yCbCrPreviewBuffer = new byte[bufferLayout.RequiredBufferSize];

And finally we can add here a new method - GetBufferFromYCbCr. It is the alternative to the GetBufferFromARGB, it returns data in the same format (but it is faster).

public int[] GetBufferFromYCbCr()
{
if (camera != null && yCbCrPreviewBuffer != null)
{
// Get preview Image buffer
try { camera.GetPreviewBufferYCbCr(yCbCrPreviewBuffer); }
catch { return null; }
?
// Select outputBuffer pixels (outputSize = smaller than 640x480 preview pixels)
CopyYCbCrValuesToOutputBuffer();
SwapRedBlueChannel(outputBuffer);
return outputBuffer;
}
return null;
}

YCbCr to RGB conversion

YCbCr is a pretty interesting color model. Y stands for the Luminance (brightness), Cr and Cb are Chrominance values (they represents the color difference). If we load to our app only a Luminance (Y) value, we will obtain a grayscale image.

Ycbcr2.png

Now we need to implement the last few helper methods. We want to select the specific pixels from the YCbCr buffer, extract the correct Y, Cr and Cb values, convert them back to the ARGB and finally to save the value of each pixel to the output buffer.

private void CopyYCbCrValuesToOutputBuffer()
{
// Copies data from YCbCr buffer to smaller output buffer (in correct ratio)
Point start = Point.Zero, incr = Point.Zero;
GetOutputParams(ref start, ref incr);
?
for (int y = 0; y < outputSize.Y; y++)
for (int x = 0; x < outputSize.X; x++)
{
// Auto flip / rotate the image to output
int sourceX = Math.Min(start.X + y * incr.X, previewSize.X - 1);
int sourceY = Math.Min(previewSize.Y - (start.Y + x * incr.Y) - 1, previewSize.Y - 1);
?
// Read Y, Cb and Cr values of the pixel
byte yValue;
int cr, cb;
GetYCbCrFromPixel(bufferLayout, yCbCrPreviewBuffer, sourceX, sourceY, out yValue, out cr, out cb);
?
// Convert to RGB and write to output buffer
int rgbPackedValue = YCbCrToArgb(yValue, cb, cr);
outputBuffer[x + y * outputSize.X] = rgbPackedValue;
}
}
private void GetYCbCrFromPixel(YCbCrPixelLayout layout, byte[] currentPreviewBuffer, int xFramePos, int yFramePos, out byte y, out int cr, out int cb)
{
// Parse YCbCr value from given pixel
// - finds the bytes corresponding to the pixel location in the frame.
int yBufferIndex = layout.YOffset + yFramePos * layout.YPitch + xFramePos * layout.YXPitch;
int crBufferIndex = layout.CrOffset + (yFramePos / 2) * layout.CrPitch + (xFramePos / 2) * layout.CrXPitch;
int cbBufferIndex = layout.CbOffset + (yFramePos / 2) * layout.CbPitch + (xFramePos / 2) * layout.CbXPitch;
?
y = currentPreviewBuffer[yBufferIndex];
cr = currentPreviewBuffer[crBufferIndex];
cb = currentPreviewBuffer[cbBufferIndex];
?
// Cr and Cb will be from -128 to 127, Y (luminance) from 0 to 255
cr -= 128;
cb -= 128;
}

Note:?These methods for unpacking YCbCr values and converting them into RGB were inspired by the former article on the MSDN (Windows Phone 7 Camera Color Conversion). The content is no longer available there.

Especially the next method for converting YCbCr value to the RGB looks totally devilish. But don't worry, it's a pretty standard algorithm. You can find lots of implementations of it on the internet. This conversion uses the integer-only divisions again (for the performance reasons).

private int YCbCrToArgb(byte y, int cb, int cr)
{
// Converts YCbCr to packed RGB
int r, g, b;
uint argbPixel;
?
// Integer-only division.
r = y + cr + (cr >> 2) + (cr >> 3) + (cr >> 5);
g = y - ((cb >> 2) + (cb >> 4) + (cb >> 5)) - ((cr >> 1) + (cr >> 3) + (cr >> 4) + (cr >> 5));
b = y + cb + (cb >> 1) + (cb >> 2) + (cb >> 6);
?
// Clamp values to 8-bit RGB range between 0 and 255.
r = r <= 255 ? r : 255;
r = r >= 0 ? r : 0;
g = g <= 255 ? g : 255;
g = g >= 0 ? g : 0;
b = b <= 255 ? b : 255;
b = b >= 0 ? b : 0;
?
// Pack individual components into a single pixel.
argbPixel = 0xff000000; // Alpha
argbPixel |= (uint)b;
argbPixel |= (uint)(g << 8);
argbPixel |= (uint)(r << 16);
?
// Return the ARGB pixel.
return unchecked((int)argbPixel);
}

Now if you switch your rendering logic in the GamePage.xaml.cs file to this line, you should see an acceleration in your frame rate speed:

int[] buffer = camReader.GetBufferFromYCbCr();

Windows Phone 8

We were talking about Windows Phone 7 devices so far. But what about newer WP8 phones? Every WP8 device can run older WP7 applications in the compatibility mode. If you run this sample on your WP8 device, it will work correctly.

But there are some limitations. Such an obsolete app runs only in fixed 800x480 resolution, we don't have an access to bigger resolutions of the HD screens. On some devices with a different screen ratio (HTC 8X), the black border at the top is displayed. We can access some newer APIs from the old app via reflection, but this is also limited. If we want to take full advantage of the new WP8 API (while still supporting the older WP7 devices), we need to make two apps. The Windows Phone Store is prepared for this scenario, we can upload two .xap files into one app submission, the correct version will be automatically downloaded for user.

Fortunately the WP8 API is very similar to the older WP7 API. Maybe they don't call it Silverlight anymore, but there is still the same C# and XAML. Except the one missing component... The XNA Framework. A minute of silence, please... If we select a new WP8 project, we have no chance to access this very powerful graphics engine. The whole idea about the efficient drawing images is now gone. So, how to solve this?

MonoGame Framework

There is a solution! MonoGame framework is an open source alternative to the XNA Framework. It is a light wrapper around the native DirectX calls and provides us the almost identical API to the XNA. It is a project with very active community and a very good support from the developers. This framework allows you to port your apps and games to WP8, Windows 8 or even on the Android and iOS.

I can recommend this framework. At this moment the Windows Phone 8 version is almost without any issue

Source: http://developer.nokia.com/Community/Wiki/index.php?title=Real-time_camera_effects_on_Windows_Phone_7_and_8&diff=206950&oldid=206950

Cotto vs Trout Robin Givens Gus Malzahn hyperemesis gravidarum BCS Bowls palestine Zig Ziglar