咋么把一个人的名字用编程放在爱心里
爱心代码加名字的设置方法如下:
一、在手机桌面打开“备忘录”,这里以“备忘录”为操作对象,其他的应用程序也是一样的操作步骤。
二、打开“备忘录”后点击右下角的“新建”标志。
三、点击键盘上的“地球”标志进行下一步操作。
四、然后在键盘上的“符号”一栏中,就可以找到“爱心”符号了。
五、最后使用空格把爱心代码移动到中间就可以了。
爱心代码安全吗
爱心代码安全的,原因如下,
爱心代码属于一种简单的编程代码,里面并不存在危险性代码,所以说安全的。
求教大神 这个C程序爱心代码
我会用c写,这里给你在linux下的c源代码://snake.h的内容:#ifndef snake_h#define snake_h#includetypedef struct snode{ struct snode *prev; struct snode *next; size_t px; size_t py; } snode; typedef enum state{ nomal, pause, quiting, } state; typedef enum direction{ up, down, left, right } direction; typedef struct snake{ snode *head; snode *tail; state state; volatile direction dir; size_t length; } snake; typedef struct been{ size_t bx; size_t by; } been; #endif//snake_h //———————————————————————————————— //snake.c 的内容: #include #include #include #include #include #include #include"snake.h" #include #include #include #define init_len 3 #define row 30 #define col 40 #define way #define wall @ #define head o #define body o #define tail . #define been * #define level 1 state state; snake *snake1; been been1; volatile direction key_pressed; size_t speed; char **map; struct termios termios_prev, termios_now; void initiate_map(){ int i, j; char *map_area; /* allocate map */ map_area = (char *)malloc(row * sizeof(char *) + row * col * sizeof(char)); if(map_area){ map = (char **)map_area; for(i = 0; i < row; ++i) map[i] = map_area+row * sizeof(int *) + i * col; } /* setup wall */ for(i = 0; i < row; ++i){ for(j = 0; j < col; ++j){ if(i == 0 || i == row - 1 || j == 0 || j == col - 1) map[i][j] = wall; else map[i][j] = way; } } } snode *newnode(int x, int y){ snode *node = (snode *)malloc(sizeof(snode)); if(node){ node->prev = node->next = null; node->px = x; node->py = y; } return node; } void add_node(int x, int y){ snode *newhead = newnode(x, y); if(!newhead) perror("newhead"), exit(-1); if(snake1->head){ snake1->head->prev = newhead; newhead->next = snake1->head; snake1->head = newhead; }else snake1->head = snake1->tail = newhead; snake1->length += 1; } void map_snake(){ snode *node; for(node = snake1->head; node; node = node->next) map[node->px][node->py] = body; map[snake1->head->px][snake1->head->py] = head; map[snake1->tail->px][snake1->tail->py] = tail; } void show_all(){ system("clear"); int i, j; printf("\n"); for(i = 0; i < row; ++i){ for(j = 0; j < col; ++j) printf("%c", map[i][j]); printf("\n"); } printf("length: %d\t press q to quit...\n", snake1->length); printf("been: row %d, col %d\n", been1.bx, been1.by); } void initiate_snake(size_t len){ snake1 = (snake *)malloc(sizeof(snake)); if(!snake1) perror("malloc snake1"), exit(-1); snake1->head = snake1->tail = null; snake1->length = 0; int i; for(i = 0; i < len; ++i) add_node(1, i + 1); snake1->dir = right; map_snake(); } void create_been(){ size_t i = 0; char *map_start = map[0]; size_t space = rand() % ((row - 2) * (col - 2) - snake1->length) + 1; while(space > 0){ if(map_start[i] == way) --space; ++i; } --i; been1.bx = i / col; been1.by = i % col; map[been1.bx][been1.by] = been; } initiate_speed(){ speed = 100000 + 500000 / level; } void initiate_all(){ state = nomal; initiate_map(); initiate_snake(init_len); srand(time(0)); create_been(); initiate_speed(); } void kb_recover(){ scanf("%*s"); tcsetattr(stdin_fileno,tcsanow, &termios_prev); } void kb_no_echo(){ tcgetattr(stdin_fileno, &termios_prev); termios_now = termios_prev; termios_now.c_lflag &= ~(echo); tcsetattr(stdin_fileno, tcsanow, &termios_now); } void free_mem(){ free(map); snode *node; while(node = snake1->head){ snake1->head = snake1->head->next; free(node); } } void *refreshing_key_pressed(){ int key_fd; struct input_event t; char *path = "/dev/input/event1"; key_fd = open(path, o_rdonly); if(key_fd == -1) perror("open input event"), exit(-1); key_pressed = right; while(1){ if(read(key_fd, &t, sizeof(t)) == sizeof(t)) if(t.type == ev_key) /* key event */ if(t.value == 1) /* key pressed */ switch(t.code){ /* whitch key */ case key_w: key_pressed = up; break; case key_a: key_pressed = left; break; case key_s: key_pressed = down; break; case key_d: key_pressed = right; break; case key_q: state = quiting; break; case key_space: { if(state == nomal) state = pause; /* nomal -> pause */ else state = nomal; /* pause -> nomal */ break; } default: break; } } } void create_thread_refresh_key_pressed(){ pthread_t pfd; int res; res = pthread_create(&pfd, 0, refreshing_key_pressed, 0); if(res != 0) perror("create thread"), exit(-1); } void it_bite_itself(){ printf("\nyou bite yourself, game over!\n"); exit(0); } void it_hit_wall(){ printf("\nyou hit wall, game over!\n"); exit(0); } void refresh_dir(){ switch(key_pressed){ case up: if(snake1->dir != down) snake1->dir = up; break; case down: if(snake1->dir != up) snake1->dir = down; break; case left: if(snake1->dir != right) snake1->dir = left; break; case right: if(snake1->dir != left) snake1->dir = right; break; default: break; } } int run_snake(){ char c; size_t row, col; usleep(speed); if(state == quiting) return 0; if(state == pause) return 1; row = snake1->head->px; col = snake1->head->py; /* state == nomal */ refresh_dir(); switch(snake1->dir){ case up: row -= 1; break; case down: row += 1; break; case left: col -= 1; break; case right: col +=1; break; default: break; } c = map[row][col]; // it eat been? if(c == wall) it_hit_wall(); else if(c == body || c == tail) it_bite_itself(); else if(c == been){ add_node(row, col); map_snake(); create_been(); } else // move { map[snake1->tail->px][snake1->tail->py] = way; snode *node; for(node = snake1->tail; node->prev; node = node->prev){ node->px = node->prev->px; node->py = node->prev->py; } snake1->head->px = row; snake1->head->py = col; map_snake(); } show_all(); return 1; } int main(){ atexit(kb_recover); initiate_all(); kb_no_echo(); /* set keyboard do not echo input */ create_thread_refresh_key_pressed(); /* to refresh snake heading direction */ show_all(); while(run_snake() && snake1->state != quiting); free_mem(); return 0; }
求一份爱心形状特征提取C++opencv的代码
整个项目的结构图:编写DetectFaceDemo.java,代码如下:[java] view plaincopyprint?package com.njupt.zhb.test; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Point; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.highgui.Highgui; import org.opencv.objdetect.CascadeClassifier; // // Detects faces in an image, draws boxes around them, and writes the results // to "faceDetection.png". //public class DetectFaceDemo {public void run() {System.out.println("\nRunning DetectFaceDemo");System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath());// Create a face detector from the cascade file in the resources // directory. //CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath()); //Mat image = Highgui.imread(getClass().getResource("lena.png").getPath()); //注意:源程序的路径会多打印一个‘/’,因此总是出现如下错误/** Detected 0 faces Writing faceDetection.png libpng warning: Image* width is zero in IHDR libpng warning: Image height is zero in IHDR* libpng error: Invalid IHDR data*///因此,我们将第一个字符去掉 String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1);CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath);Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1));// Detect faces in the image. // MatOfRect is a special container class for Rect. MatOfRect faceDetections = new MatOfRect();faceDetector.detectMultiScale(image, faceDetections); System.out.println(String.format("Detected %s faces", faceDetections.toArray().length)); // Draw a bounding box around each face. for (Rect rect : faceDetections.toArray()) {Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));} // Save the visualized detection. String filename = "faceDetection.png";System.out.println(String.format("Writing %s", filename));Highgui.imwrite(filename, image);} } package com.njupt.zhb.test;import org.opencv.core.Core;import org.opencv.core.Mat;import org.opencv.core.MatOfRect;import org.opencv.core.Point;import org.opencv.core.Rect;import org.opencv.core.Scalar;import org.opencv.highgui.Highgui;import org.opencv.objdetect.CascadeClassifier;//// Detects faces in an image, draws boxes around them, and writes the results// to "faceDetection.png".//public class DetectFaceDemo { public void run() {System.out.println("\nRunning DetectFaceDemo");System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath());// Create a face detector from the cascade file in the resources// directory.//CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath());//Mat image = Highgui.imread(getClass().getResource("lena.png").getPath());//注意:源程序的路径会多打印一个‘/’,因此总是出现如下错误/** Detected 0 faces Writing faceDetection.png libpng warning: Image* width is zero in IHDR libpng warning: Image height is zero in IHDR* libpng error: Invalid IHDR data*///因此,我们将第一个字符去掉String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1);CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath);Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1));// Detect faces in the image.// MatOfRect is a special container class for Rect.MatOfRect faceDetections = new MatOfRect();faceDetector.detectMultiScale(image, faceDetections);System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));// Draw a bounding box around each face.for (Rect rect : faceDetections.toArray()) {Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));}// Save the visualized detection.String filename = "faceDetection.png";System.out.println(String.format("Writing %s", filename));Highgui.imwrite(filename, image); }}3.编写测试类:[java] view plaincopyprint?package com.njupt.zhb.test; public class TestMain {public static void main(String[] args) {System.out.println("Hello, OpenCV");// Load the native library. System.loadLibrary("opencv_java246");new DetectFaceDemo().run();} } //运行结果://Hello, OpenCV ////Running DetectFaceDemo ///E:/eclipse_Jee/workspace/JavaOpenCV246/bin/com/njupt/zhb/test/lbpcascade_frontalface.xml //Detected 8 faces //Writing faceDetection.png package com.njupt.zhb.test;public class TestMain { public static void main(String[] args) {System.out.println("Hello, OpenCV");// Load the native library.System.loadLibrary("opencv_java246");new DetectFaceDemo().run(); }}//运行结果://Hello, OpenCV////Running DetectFaceDemo///E:/eclipse_Jee/workspace/JavaOpenCV246/bin/com/njupt/zhb/test/lbpcascade_frontalface.xml//Detected 8 faces//Writing faceDetection.png