
humanidade, upload feito originalmente por Silveira Neto.
humanidade, upload feito originalmente por Silveira Neto.
O Grupo de Usuários Java do Ceará estará realizando no próximo dia 04 de dezembro o CEJUG Tech Day na Fanor.
Este ano, precisamente nos dias 8 e 9 de dezembro, a Sun Microsystems estará realizando a edição 2009-2010 do Sun Tech Days, em São Paulo. Provavelmente será o último STD realizado. Felizmente, teremos mais uma vez um palestrante internacional da Sun, graças ao MaurÃcio Leal, que organizou mais uma caravana dos palestrantes da Sun no Brasil.
Simon Ritter já esteve em Fortaleza participando do Café com Tapioca de Coco em 2008 e este ano palestrará sobre o futuro da JDK 7. Guilherme Silveira também participará e falará sobre REST e RESTful. Julio Viegas falará sobre infraestrutura e ambientes em Java de alta demanda e por fim, Josênio Cândido falará sobre o CMS Vignette.
Se você mora em Fortaleza não deixe de comparecer ao evento, a inscrição é gratuita com a adição de 2 quilos de alimentos não perecÃveis que serão doados para instituições de caridade.
Código-fonte dos cartazes:
Here’s a simple video player that also performs facial detection thought the Open Computer Vision Library.
Here’s a code developed using codes from nashruddin.com and samples from OpenCV, including the haar classifier xml. More detailed explanation on the theory about how the OpenCV face detection algorithm works can be found here.
The code:
#include
#include
#include
CvHaarClassifierCascade *cascade;
CvMemStorage *storage;
int main(int argc, char *argv[]) {
CvCapture *video = NULL;
IplImage *frame = NULL;
int delay = 0, key, i=0;
char *window_name = "Video";
char *cascadefile = "haarcascade_frontalface_alt.xml";
/* check for video file passed by command line */
if (argc>1) {
video = cvCaptureFromFile(argv[1]);
}
else {
printf("Usage: %s VIDEO_FILE\n", argv[0]);
return 1;
}
/* check file was correctly opened */
if (!video) {
printf("Unable to open \"%s\"\n", argv[1]);
return 1;
}
/* load the classifier */
cascade = ( CvHaarClassifierCascade* )cvLoad( cascadefile, 0, 0, 0 );
if(!cascade){
printf("Error loading the classifier.");
return 1;
}
/* setup the memory buffer for the face detector */
storage = cvCreateMemStorage( 0 );
if(!storage){
printf("Error creating the memory storage.");
return 1;
}
/* create a video window, auto size */
cvNamedWindow(window_name, CV_WINDOW_AUTOSIZE);
/* get a frame. Necessary for use the cvGetCaptureProperty */
frame = cvQueryFrame(video);
/* calculate the delay between each frame and display video's FPS */
printf("%2.2f FPS\n", cvGetCaptureProperty(video, CV_CAP_PROP_FPS));
delay = (int) (1000/cvGetCaptureProperty(video, CV_CAP_PROP_FPS));
while (frame) {
/* show loaded frame */
cvShowImage(window_name, frame);
/* wait delay and check for the quit key */
key = cvWaitKey(delay);
if(key=='q') break;
/* load and check next frame*/
frame = cvQueryFrame(video);
if(!frame) {
printf("error loading frame.\n");
return 1;
}
/* detect faces */
CvSeq *faces = cvHaarDetectObjects(
frame, /* image to detect objects in */
cascade, /* haar classifier cascade */
storage, /* resultant sequence of the object candidate rectangles */
1.1, /* increse window by 10% between the subsequent scans*/
3, /* 3 neighbors makes up an object */
0 /* flags CV_HAAR_DO_CANNY_PRUNNING */,
cvSize( 40, 40 )
);
/* for each face found, draw a red box */
for( i = 0 ; i < ( faces ? faces->total : 0 ) ; i++ ) {
CvRect *r = ( CvRect* )cvGetSeqElem( faces, i );
cvRectangle( frame,
cvPoint( r->x, r->y ),
cvPoint( r->x + r->width, r->y + r->height ),
CV_RGB( 255, 0, 0 ), 1, 8, 0 );
}
}
}
Yeah, I know the code needs a few adjustments. ¬¬
To compile it in a well configured OpenCV development environment:
gcc faceplayer.c -o faceplayer `pkg-config opencv ‑‑libs ‑‑cflags`
To run it you have to put in the same directory of the binary the XML classifier (haarcascade_frontalface_alt.xml) that comes with OpenCV sources at OpenCV-2.0.0/data/haarcascades/. And so:
./faceplayer video.avi
The results I got so far is that it works well for faces but sometimes its also detects more than faces. And here a video of it working live.
A example of good result:
A example of bad result:
Maybe with some adjustments it could performs even better. But was really easy to create it using OpenCV.
I found this useful tip about how to convert videos to watch on Nokia n800 using Mencoder.
mencoder input.ogg -vf scale=400:240 -oac mp3lame -ovc lavc -o output.avi
It’s converts a filed called input.ogg to a avi file output.avi with height 240 and width 400 (the device resolution is 800×480) , mp3lame audio codec and libavcodec video.
As this has become a daily operation to me, I create this simple script called 2n800:
#!/bin/sh
if [ $# -ge 1 ];
then
mencoder $1 -vf scale=400:240 -oac mp3lame -ovc lavc -o ${1%\.*}.avi
else
echo Usage:
echo "\t$0 FILE"
fi
It transforms the first parameter like something.flv to something.avi. Putting this script as executable on your path like on /usr/bin/ you can easily call the command 2n800 followed with tha name of your video you want to convert. If is readable by Mplayer, it will be converted.
After you converted you video and sent to your n800, you can watch on Mplayer to Maemo. The result is perfect.
Amazing video showing our DNA synthesis as a Turing-machine-like.
Hi guys from Mayflower! Thanks for the free Zend Framework poster. It’s great.
Using reflection to change the accessibility of a private object field and access it at runtime.
import java.lang.reflect.Field;
class Life {
private int meaning = 42;
}
class Hack {
public static void main(String args[]){
Life life = new Life();
try {
Field field = life.getClass().getDeclaredField("meaning");
field.setAccessible(true);
System.out.println(field.get(life));
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e){
e.printStackTrace();
}
}
}
Output:
42
Nem só de morte vive o kill.
Suponha que você tem um processo chamado program e quer congelar seu funcionamento. Para congela-lo sem mata-lo você pode mandar um sinal SIGSTOP com:
kill -s stop `pidof program`
Para ressuscitar o mesmo processo:
kill -s cont `pidof program`