Linux系统USB摄像头测试程序(三)_视频预览

这是在linux上usb摄像头视频预览程序,此程序用到了ffmpeg、sdl2、gtk3组件,程序编译之前应先安装他们。

#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <zconf.h>
#include <linux/videodev2.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gtk-3.0/gtk/gtk.h>#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
#include "libavdevice/avdevice.h"
#include "libavutil/imgutils.h"
#include <libavfilter/avfilter.h>
#include <libavfilter/buffersrc.h>
#include <libavfilter/buffersink.h>#include <SDL2/SDL.h>//dhl:gtk窗口组件
GtkWidget *window;
GtkWidget *fixed;
GtkWidget *button1,*button2,*button3;
GtkWidget *text,*text1,*text2,*text3;
GtkTextBuffer *buffer,*buffer1,*buffer2,*buffer3;
GtkWidget *label1,*label2,*label3,*label_line;//dhl:sdl窗口组件
SDL_Window *sdl_window; 
SDL_Renderer *sdl_renderer;
SDL_Texture *sdl_texture;//dhl:消息缓存
char disp[2048]={0};
char temp[128]={0};int getWHR(char *device_name,char *win_size,int *win_width,int *win_height, char *frame_rate_t)
{GtkTextIter start,end;gtk_text_buffer_get_bounds(GTK_TEXT_BUFFER(buffer1),&start,&end);GtkTextIter s=start,e=end;sprintf(device_name,"%s",gtk_text_buffer_get_text(GTK_TEXT_BUFFER(buffer1),&s,&e,FALSE));gtk_text_buffer_get_bounds(GTK_TEXT_BUFFER(buffer2),&start,&end);s=start,e=end;gchar *win_size1 = gtk_text_buffer_get_text(GTK_TEXT_BUFFER(buffer2),&s,&e,FALSE);sprintf(win_size,"%s",gtk_text_buffer_get_text(GTK_TEXT_BUFFER(buffer2),&s,&e,FALSE));gtk_text_buffer_get_bounds(GTK_TEXT_BUFFER(buffer3),&start,&end);s=start,e=end;sprintf(frame_rate_t,"%s",gtk_text_buffer_get_text(GTK_TEXT_BUFFER(buffer3),&s,&e,FALSE));if (!strcmp(device_name,"")|| !strcmp(win_size,"")||!strcmp(frame_rate_t,"")) {GtkWidget * dialog= dialog = gtk_message_dialog_new (NULL,GTK_DIALOG_DESTROY_WITH_PARENT,GTK_MESSAGE_INFO,GTK_BUTTONS_CLOSE,"请输入摄像头设备名称、窗口尺寸、帧速率");gtk_dialog_run (GTK_DIALOG (dialog));gtk_widget_destroy (dialog);return -1;}sscanf(win_size1, "%dx%d", win_width, win_height);return 0;
}//dhl:发现摄像头
void button1_clicked(GtkWidget *widget, gpointer data)
{char camera_devices_name[128]={0};for (int loop=0;loop<10;loop++) {sprintf(camera_devices_name,"/dev/video%d",loop);int fd = open(camera_devices_name, O_RDWR);if(fd < 0){printf("打开设备失败(%s)\n",camera_devices_name);close(fd);continue;}close(fd);sprintf(temp,"发现摄像头:%s\n",camera_devices_name);strcat(disp,temp);gtk_text_buffer_set_text(buffer,disp,-1);}sprintf(disp,"%s","");
}//dhl:查询配置信息
void button2_clicked(GtkWidget *widget, gpointer data)
{int line_num=0;gchar *device_name;GtkTextIter start,end;gtk_text_buffer_get_bounds(GTK_TEXT_BUFFER(buffer1),&start,&end);const GtkTextIter s=start,e=end;device_name=gtk_text_buffer_get_text(GTK_TEXT_BUFFER(buffer1),&s,&e,FALSE);if (!strcmp(device_name,"")){sprintf(temp,"请输入摄像头设备文件名\n");strcat(disp,temp);gtk_text_buffer_set_text(buffer,disp,-1);sprintf(disp,"%s","");return;}//dhl:查询摄像头支持的视频格式int fd = open(device_name, O_RDWR);if(fd < 0){printf("打开设备失败\n");return;}struct v4l2_fmtdesc v4fmt;v4fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; //视频捕获设备int i=0;while(1){v4fmt.index = i++;int ret = ioctl(fd, VIDIOC_ENUM_FMT, &v4fmt);if(ret < 0){printf("获取摄像头格式失败");break;}printf("index=%d\n", v4fmt.index);printf("flags=%d\n", v4fmt.flags);printf("description=%s\n", v4fmt.description);unsigned char *p = (unsigned char *)&v4fmt.pixelformat;printf("pixelformat=%c%c%c%c\n", p[0],p[1],p[2],p[3]);printf("reserved=%d\n", v4fmt.reserved[0]);sprintf(temp,"摄像头支持的视频格式(%d)\n",i);strcat(disp,temp);sprintf(temp,"index=%d,", v4fmt.index);strcat(disp,temp);sprintf(temp,"flags=%d,", v4fmt.flags);strcat(disp,temp);sprintf(temp,"description=%s,", v4fmt.description);strcat(disp,temp);sprintf(temp,"pixelformat=%c%c%c%c,", p[0],p[1],p[2],p[3]);strcat(disp,temp);sprintf(temp,"reserved=%d\n", v4fmt.reserved[0]);strcat(disp,temp);}close(fd);//dhl:MJPG支持的所有分辨率如下fd = open(device_name, O_RDWR);if(fd < 0){perror("打开设备失败");return;}struct v4l2_frmsizeenum frmsize;frmsize.index = 0;frmsize.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;printf("MJPEG格式支持所有分辨率如下:\n");//frmsize.pixel_format = V4L2_PIX_FMT_YUYV;frmsize.pixel_format = V4L2_PIX_FMT_MJPEG;sprintf(temp,"MJPG支持的分辨率:\n");strcat(disp,temp);line_num=1;while(ioctl(fd,VIDIOC_ENUM_FRAMESIZES,&frmsize) == 0){printf("frame_size<%d*%d>\n",frmsize.discrete.width,frmsize.discrete.height);frmsize.index++;if ((line_num % 5) != 0) { sprintf(temp,"MJPEG frame_size<%d*%d>, ",frmsize.discrete.width,frmsize.discrete.height);}else {sprintf(temp,"MJPEG frame_size<%d*%d>\n",frmsize.discrete.width,frmsize.discrete.height);}strcat(disp,temp);line_num++;if (line_num == 6) {line_num = 1;}}close(fd);sprintf(temp,"%s","\n");strcat(disp,temp);//dhl:YUV支持所有分辨率如下fd = open(device_name, O_RDWR);if(fd < 0){perror("打开设备失败");return;}//struct v4l2_frmsizeenum frmsize;frmsize.index = 0;frmsize.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;printf("MJPEG格式支持所有分辨率如下:\n");frmsize.pixel_format = V4L2_PIX_FMT_YUYV;//frmsize.pixel_format = V4L2_PIX_FMT_MJPEG;sprintf(temp,"YUV支持的分辨率:\n");strcat(disp,temp);line_num = 1;while(ioctl(fd,VIDIOC_ENUM_FRAMESIZES,&frmsize) == 0){printf("frame_size<%d*%d>\n",frmsize.discrete.width,frmsize.discrete.height);frmsize.index++;if ((line_num % 5) != 0) { sprintf(temp,"YUYV frame_size<%d*%d>, ",frmsize.discrete.width,frmsize.discrete.height);}else {sprintf(temp,"YUYV frame_size<%d*%d>\n",frmsize.discrete.width,frmsize.discrete.height);}strcat(disp,temp);line_num++;if (line_num == 6) {line_num = 1;}}close(fd);gtk_text_buffer_set_text(buffer,disp,-1);sprintf(disp,"%s","");}//dhl:视频预览
void button3_clicked(GtkWidget *widget, gpointer data)
{AVFormatContext *pFormatCtx;int             i, videoindex;AVCodecContext  *pCodecCtx;AVCodec         *pCodec;int ret = -1;int win_width=0, win_height=0;gchar device_name[128];gchar win_size[128];gchar frame_rate_t[128];int iRet=getWHR(device_name,win_size,&win_width,&win_height, frame_rate_t);if (iRet!=0) {return;}const char * out_path = "out_yuyv422.yuv";FILE* outFile = fopen(out_path, "wb");if (!outFile) {printf("Could not open %s\n", out_path);return;}if (SDL_Init(SDL_INIT_VIDEO)) {printf("Could not initialize SDL - %s\n", SDL_GetError());return;}else{printf("initialize SDL ok\n");}sdl_window = SDL_CreateWindow("视频预览",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,win_width,win_height,SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE);if(sdl_window == NULL){printf("SDL_window创建失败\n");return;}sdl_renderer = SDL_CreateRenderer(sdl_window,-1,SDL_RENDERER_ACCELERATED);sdl_texture = SDL_CreateTexture(sdl_renderer//,SDL_PIXELFORMAT_IYUV,SDL_PIXELFORMAT_YUY2,SDL_TEXTUREACCESS_TARGET,win_width,win_height);SDL_Rect sdl_rect;char *buffer_pixels = malloc(win_width*win_height*4);pFormatCtx = avformat_alloc_context();const AVInputFormat *ifmt = av_find_input_format("v4l2");AVDictionary *option =NULL;av_dict_set(&option,"video_size",win_size,0);av_dict_set(&option,"framerate",frame_rate_t,0);//av_dict_set(&option,"pixel_format","yuv420p12be",0); //指定格式avformat_open_input(&pFormatCtx, device_name, ifmt,&option);if(avformat_find_stream_info(pFormatCtx, NULL) < 0){printf("Couldn't find stream information.\n");return;}videoindex = -1;for(i = 0; i < pFormatCtx->nb_streams; i++){if(pFormatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO){videoindex = i;break;}}if(videoindex == -1){printf("Didn't find a video stream.\n");return;}else{printf("Find a video stream:%d.\n", videoindex);}pCodec = (AVCodec*)avcodec_find_decoder(pFormatCtx->streams[videoindex]->codecpar->codec_id);if(pCodec == NULL){printf("Codec not found.\n");return;}pCodecCtx = avcodec_alloc_context3(pCodec);avcodec_parameters_to_context(pCodecCtx, pFormatCtx->streams[videoindex]->codecpar);printf("VideoStream:Frame.Width=%d,Height=%d\n",pCodecCtx->width, pCodecCtx->height);if(avcodec_open2(pCodecCtx, pCodec, NULL) < 0){printf("Could not open codec.\n");return;}AVPacket *pkt = av_packet_alloc();if(!pkt){printf("av_packet_alloc错误\n");return;}AVFrame *frame_yuyv422 = av_frame_alloc();if(!frame_yuyv422){printf("av_frame_alloc错误\n");return;}int frame_count = 0;//记录获取的帧数SDL_Event event;while (av_read_frame(pFormatCtx, pkt) >= 0 ) {if(pkt->stream_index == videoindex){//dhl:发送给解码器if(avcodec_send_packet(pCodecCtx,pkt) != 0){printf("avcodec_send_packet error ...\n");break;}//dhl:从解码器中得到摄像头的原始视频帧int loop=0;while(avcodec_receive_frame(pCodecCtx,frame_yuyv422) == 0){frame_count++;for(int i = 0;i < frame_yuyv422->height;i++){memcpy(buffer_pixels+i * frame_yuyv422->linesize[0],frame_yuyv422->data[0] + i * frame_yuyv422->linesize[0],frame_yuyv422->linesize[0]);}SDL_UpdateTexture(sdl_texture,NULL,buffer_pixels,win_width*2);//dhl:将纹理数据拷贝给渲染器sdl_rect.x = 0;sdl_rect.y = 0;sdl_rect.w = win_width;sdl_rect.h = win_height;//dhl:先清空帧画面,再重新绘制SDL_RenderClear(sdl_renderer);SDL_RenderCopy(sdl_renderer,sdl_texture,NULL,&sdl_rect);//dhl:显示帧画面SDL_RenderPresent(sdl_renderer);//dhl:延时渲染//SDL_Delay(frame_rate);//延时}}av_packet_unref(pkt);for (int ll=0;ll<10;ll++) {SDL_PollEvent(&event);}	if (event.type == SDL_QUIT) {break;}}fclose(outFile);sprintf(disp,"预览总帧数:%d",frame_count);gtk_text_buffer_set_text(buffer,disp,-1);sprintf(disp,"%s","");av_free(frame_yuyv422);av_packet_free(&pkt);avformat_close_input(&pFormatCtx);free(buffer_pixels);SDL_DestroyTexture(sdl_texture);SDL_DestroyRenderer(sdl_renderer);SDL_DestroyWindow(sdl_window );		SDL_Quit();return;}int main(int argc,char *argv[])
{gtk_init(&argc,&argv);avdevice_register_all();window = gtk_window_new(GTK_WINDOW_TOPLEVEL);gtk_window_set_title(GTK_WINDOW(window),"USB摄像头测试程序(v1.0.20230728)");//gtk_window_set_resizable(GTK_WINDOW(window),FALSE);gtk_window_set_default_size(GTK_WINDOW(window),1280,800);gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);fixed = gtk_fixed_new();gtk_container_add(GTK_CONTAINER(window),fixed);text = gtk_text_view_new();buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));gtk_text_buffer_set_text(buffer,"",-1);gtk_fixed_put(GTK_FIXED(fixed),text,20,480);gtk_widget_set_size_request(text,1240,300);button1 = gtk_button_new_with_label("查询摄像头");gtk_fixed_put(GTK_FIXED(fixed),button1,320,14);gtk_widget_set_size_request(button1,100,20);label1 = gtk_label_new("摄像头:");gtk_fixed_put(GTK_FIXED(fixed),label1,440,14);gtk_widget_set_size_request(label1,50,30);text1 = gtk_text_view_new();buffer1=gtk_text_view_get_buffer(GTK_TEXT_VIEW(text1));gtk_text_buffer_set_text(buffer1,"",-1);gtk_fixed_put(GTK_FIXED(fixed),text1,500,16);gtk_widget_set_size_request(text1,100,28);sprintf(disp,"/dev/video0");gtk_text_buffer_set_text(buffer1,disp,-1);button2 = gtk_button_new_with_label("查询配置");gtk_fixed_put(GTK_FIXED(fixed),button2,610,14);gtk_widget_set_size_request(button2,80,35);label2 = gtk_label_new("分辨率:");gtk_fixed_put(GTK_FIXED(fixed),label2,740,18);gtk_widget_set_size_request(label2,50,30);text2 = gtk_text_view_new();buffer2=gtk_text_view_get_buffer(GTK_TEXT_VIEW(text2));gtk_text_buffer_set_text(buffer2,"",-1);gtk_fixed_put(GTK_FIXED(fixed),text2,800,16);gtk_widget_set_size_request(text2,100,28);sprintf(disp,"640x480");gtk_text_buffer_set_text(buffer2,disp,-1);label3 = gtk_label_new("帧率:");gtk_fixed_put(GTK_FIXED(fixed),label3,930,18);gtk_widget_set_size_request(label3,50,30);text3 = gtk_text_view_new();buffer3=gtk_text_view_get_buffer(GTK_TEXT_VIEW(text3));gtk_text_buffer_set_text(buffer3,"",-1);gtk_fixed_put(GTK_FIXED(fixed),text3,980,16);gtk_widget_set_size_request(text3,100,28);sprintf(disp,"30");gtk_text_buffer_set_text(buffer3,disp,-1);label_line = gtk_label_new("______________________________________________________________________________________________________________________________");gtk_fixed_put(GTK_FIXED(fixed),label_line,320,45);gtk_widget_set_size_request(label_line,800,3);GtkWidget *labelChild;PangoFontDescription *font;int fontSize = 10;font = pango_font_description_from_string("Sans");				//"Sans"字体名pango_font_description_set_size(font, fontSize * PANGO_SCALE);	//设置字体大小labelChild = gtk_bin_get_child(GTK_WIDGET(button1));			//取出GtkButton里的labelgtk_widget_modify_font(GTK_WIDGET(labelChild), font);			//设置label的字体, 这样这个GtkButton上面显示的字体就变了labelChild = gtk_bin_get_child(GTK_WIDGET(button2));			gtk_widget_modify_font(GTK_WIDGET(labelChild), font);			button3 = gtk_button_new_with_label("视频预览");gtk_fixed_put(GTK_FIXED(fixed),button3,320,80);gtk_widget_set_size_request(button3,80,20);g_signal_connect_swapped(G_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL);g_signal_connect_swapped(G_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL);g_signal_connect(G_OBJECT(button1), "clicked", G_CALLBACK(button1_clicked),NULL);g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK(button2_clicked),NULL);g_signal_connect(G_OBJECT(button3), "clicked", G_CALLBACK(button3_clicked),NULL);	gtk_widget_show_all(window);gtk_main();return 0;
}

编译命令:gcc preview_camera.c  -o camera_preview `pkg-config --cflags --libs  libavdevice libavfilter libavformat  libavcodec libavutil libpostproc  libswresample  libswscale` `pkg-config --cflags --libs sdl2` `pkg-config --cflags --libs gtk+-3.0`  -w

运行截图:

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/101547.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

代码随想录算法训练营第四十二天 | 01背包问题,01背包问题(滚动数组),416. 分割等和子集

代码随想录算法训练营第四十二天 01背包问题01 背包二维dp数组01背包 01背包问题(滚动数组)416. 分割等和子集 01背包问题 视频讲解 以下是几种背包&#xff0c;如下&#xff1a; 至于背包九讲其其他背包&#xff0c;面试几乎不会问&#xff0c;都是竞赛级别的了&#xff0c;…

HBuilderX学习--运行第一个项目

HBuilderX&#xff0c;简称HX&#xff0c;是轻如编辑器、强如IDE的合体版本&#xff0c;它及轻巧、极速&#xff0c;强大的语法提示&#xff0c;提供比其他工具更优秀的vue支持大幅提升vue开发效率于一身(具体可看官方详细解释)… 一&#xff0c;HBuilderX下载安装 官网地址 …

mybatis动态SQL的运用

一、mybatis动态SQL update 表名 set name?,age? where id? 如果我们的前台没有传参&#xff0c;比如没有传入我们的name值&#xff0c;name就会把字段值改为null&#xff0c;这就违背了我们编码的初衷。 许多人会使用类似于where 1 1 来作为前缀&#xff0c;在代码中会用i…

企业数字化转型大数据湖一体化平台项目建设方案PPT

导读&#xff1a;原文《企业数字化转型大数据湖一体化平台项目建设方案PPT》&#xff08;获取来源见文尾&#xff09;&#xff0c;本文精选其中精华及架构部分&#xff0c;逻辑清晰、内容完整&#xff0c;为快速形成售前方案提供参考。 喜欢文章&#xff0c;您可以点赞评论转发…

Django视图-HttpRequest请求对象和HttpResponse响应对象

文章目录 HttpRequestHttpResponse实践request对象的属性和方法响应 def index(request): 这个request其实就是内部已经封装好的Http请求HttpRequest&#xff0c;它是一个请求对象Django中的视图主要用来接受Web请求&#xff0c;并做出响应。 视图的本质就是一个Python中的函数…

手机debug模式无法连接AndroidStudio,或者Android项目运行失败

在开发中&#xff0c;经常会遇到手机开发模式无法连接AndroidStudio;或者连接后运行失败的问题&#xff0c;请关闭以下设置。

Android学习之路(9) Intent

Intent 是一个消息传递对象&#xff0c;您可以用来从其他应用组件请求操作。尽管 Intent 可以通过多种方式促进组件之间的通信&#xff0c;但其基本用例主要包括以下三个&#xff1a; 启动 Activity Activity 表示应用中的一个屏幕。通过将 Intent 传递给 startActivity()&…

SpringMVC拦截器学习笔记

SpringMVC拦截器 拦截器知识 拦截器(Interceptor)用于对URL请求进行前置/后置过滤 Interceptor与Filter用途相似但实现方式不同 Interceptor底层就是基于Spring AOP面向切面编程实现 拦截器开发流程 Maven添加依赖包servlet-api <dependency><groupId>javax.se…

基于Spring Boot的游泳馆管理系统的设计与实现(Java+spring boot+MySQL)

获取源码或者论文请私信博主 演示视频&#xff1a; 基于Spring Boot的游泳馆管理系统的设计与实现&#xff08;Javaspring bootMySQL&#xff09; 使用技术&#xff1a; 前端&#xff1a;html css javascript jQuery ajax thymeleaf 微信小程序 后端&#xff1a;Java spring…

阿里云容器镜像服务ACR(Alibaba Cloud Container Registry)推送镜像全过程及总结

前提&#xff1a;安装配置好docker&#xff0c;可参考我这篇 基于CentOS7安装配置docker与docker-compose。 一、设置访问凭证 1.1 容器镜像服务ACR 登录进入阿里云首页&#xff0c;点击 产品-容器-容器镜像服务ACR 点击管理控制台 1.2 进入控制台-点击实例列表 个人容器…

xcode14.3更新一系列问题

1. Missing file libarclite_iphoneos.a (Xcode 14.3) 解决方法 Xcode升级到14.3后编译失败&#xff0c;完整错误日志&#xff1a; File not found: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneo…

简单介绍 CPU 的工作原理

内部架构 CPU 的根本任务就是执行指令&#xff0c;对计算机来说最终都是一串由 0 和 1 组成的序列。CPU 从逻辑上可以划分成 3 个模块&#xff0c;分别是控制单元、运算单元和存储单元 。其内部架构如下&#xff1a; 【1】控制单元 控制单元是整个CPU的指挥控制中心&#xff…

HarmonyOS/OpenHarmony应用开发-ArkTS语言渲染控制LazyForEach数据懒加载

LazyForEach从提供的数据源中按需迭代数据&#xff0c;并在每次迭代过程中创建相应的组件。当LazyForEach在滚动容器中使用了&#xff0c;框架会根据滚动容器可视区域按需创建组件&#xff0c;当组件划出可视区域外时&#xff0c;框架会进行组件销毁回收以降低内存占用。一、接…

【计算机视觉|生成对抗】StackGAN:使用堆叠生成对抗网络进行文本到照片逼真图像合成

本系列博文为深度学习/计算机视觉论文笔记&#xff0c;转载请注明出处 标题&#xff1a;StackGAN: Text to Photo-realistic Image Synthesis with Stacked Generative Adversarial Networks 链接&#xff1a;[1612.03242] StackGAN: Text to Photo-realistic Image Synthesis…

[Mac软件]Pixelmator Pro 3.3.12 专业图像编辑中文版

Pixelmator Pro是专为Mac设计的功能强大&#xff0c;美观且易于使用的图像编辑器。借助广泛的专业级无损图像编辑工具&#xff0c;Pixelmator Pro可使您发挥出最佳的照片效果&#xff0c;创建华丽的构图和设计&#xff0c;绘制&#xff0c;绘画&#xff0c;应用令人惊叹的效果&…

scala中json4s 使用详解

预备知识 json4s的数据结构AST (Abstract Syntax Tree)。 sealed abstract class JValue case object JNothing extends JValue // zero for JValue case object JNull extends JValue case class JString(s: String) extends JValue case class JDouble(num: Double) extend…

Vulnhub系列靶机--- Hackadmeic.RTB1

系列&#xff1a;Hackademic&#xff08;此系列共2台&#xff09; 难度&#xff1a;初级 信息收集 主机发现 netdiscover -r 192.168.80.0/24端口扫描 nmap -A -p- 192.168.80.143访问80端口 使用指纹识别插件查看是WordPress 根据首页显示的内容&#xff0c;点击target 点击…

0822|C++day2 引用+函数重载

一、左值引用(reference) 如果想要实现两个数据的交换&#xff0c;值传递不能交换实参&#xff0c;地址传递可以交换实参&#xff0c;会额外开辟空间 【1】概念 引用其实就是给变量起了一个别名&#xff0c;孙悟空(齐天大圣)C对C的一个最重要的扩充 【2】定义 数据类型 &am…

Leetcode---359周赛

题目列表 2828. 判别首字母缩略词 2829. k-avoiding 数组的最小总和 2830. 销售利润最大化 2831. 找出最长等值子数组 一、判断首字母缩略词 纯模拟&#xff0c;代码如下 class Solution { public:bool isAcronym(vector<string>& words, string s) {string tmp…

Faster RCNN网络数据流总结

前言 在学习Faster RCNN时&#xff0c;看了许多别人写的博客。看了以后&#xff0c;对Faster RCNN整理有了一个大概的了解&#xff0c;但是对训练时网络内部的数据流还不是很清楚&#xff0c;所以在结合这个版本的faster rcnn代码情况下&#xff0c;对网络数据流进行总结。以便…