當前位置:首頁 » 編程語言 » c語言控制相機對焦代碼
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

c語言控制相機對焦代碼

發布時間: 2022-06-01 01:13:24

c語言編程源代碼翻譯

#include<stdio.h>//頭文件
intmain(void)//主函數
{
intdogs;//定義整型變數dogs
printf("Howmanydogsdoyouhave? ");//屏幕上輸出:Howmanydogsdoyouhave?
scanf("%d",&dogs);//從鍵盤輸入一個數,這個數給dogs賦值,之後dogs的值就是這個數
printf("soyouhave%ddog(s)! ",dogs);//屏幕上輸出:soyouhave(你從鍵盤輸入的那個數)dog(s)!
return0;
}
}

② 求C語言從攝像頭獲取數據的代碼

你到畫圖面版里把你的BMP圖打開,另存為的時候改成JPG格式,或者在你的電腦中打開文件夾選項把帶有後綴的文件名的勾去掉,在BMP的圖片後面更改成你需要的格式

③ 求自動對焦的C語言或者C++程序。

函數名:sleep
功能:執行掛起一段時間
用法:unsignedsleep(unsignedseconds);
程序例:#include<dos.h>
#include<stdio.h>intmain(void)
{
inti;for(i=1;i<5;i++)
{
printf("Sleepingfor%dseconds\n",i);
sleep(i);
}
return0;
}
函數名:sleep
功能:執行掛起一段時間
用法:unsignedsleep(unsignedseconds);
程序例:#include<dos.h>
#include<stdio.h>intmain(void)
{
inti;for(i=1;i<5;i++)
{
printf("Sleepingfor%dseconds\n",i);
sleep(i);
}
return0;
}希望對你有所幫助,祝好運。
PS:為啥不給點兒分呢~

④ 請問有沒手上有簡單的攝像機對焦演算法源代碼,最好用C語言寫的,偶正在學習,剛接觸,還望各位大俠幫助,鞋

不好意思沒有啊

⑤ 求編一個相機自動拍照的C語言控製程序

他應該提供開發環境,或者運行庫,以及詳細的說明的,否則沒法編啊;

那麼應該提供自己的庫,以及詳盡的說明文檔和常式,否則沒法編的;因為工控這種東西專一性太強。

⑥ 基於51單片機紅外遙控代碼(C語言)

以下文件是51單片機實現遙控解碼,通過數碼管顯示鍵碼的程序,P0口驅動數碼管段選,p2.6和p2.7為數碼管位選,接收頭連到P3.2口。此程序以通過驗證,可以直接編譯使用,另外還有一個繼電器和蜂鳴器的控制,不用可以屏蔽掉。

;********************************************************************************
;* 描述: *
;* 遙控鍵值讀取器 *
;* 數碼管顯示, P0口為數碼管的數據口 *
;* *
;********************************************************************************
;遙控鍵值解碼-數碼管顯示 *
;********************************************************************************/

#include <reg51.h>
#include <intrins.h>

void IR_SHOW();
void delay(unsigned char x);//x*0.14MS
void delay1(unsigned char ms);
void beep();

sbit IRIN = P3^2;
sbit BEEP = P3^7;
sbit RELAY= P1^3;
sbit GEWEI= P2^7;
sbit SHIWEI= P2^6;

unsigned char IRCOM[8];
unsigned char code table[16] =
{0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
main()
{
IE = 0x81; //允許總中斷中斷,使能 INT0 外部中斷
TCON = 0x1; //觸發方式為脈沖負邊沿觸發
delay(1);

IRIN=1;
BEEP=1;
RELAY=1;
for(;;)
{
IR_SHOW();
}

} //end main

void IR_IN() interrupt 0 using 0
{
unsigned char i,j,k,N=0;
EA = 0;
I1:
for (i=0;i<4;i++)
{
if (IRIN==0) break;
if (i==3) {EA =1;return;}
}
delay(20);
if (IRIN==1) goto I1; //確認IR信號出現
while (!IRIN) //等 IR 變為高電平
{delay(1);}

for (j=0;j<4;j++)
{
for (k=0;k<8;k++)
{
while (IRIN) //等 IR 變為低電平
{delay(1);}
while (!IRIN) //等 IR 變為高電平
{delay(1);}
while (IRIN) //計算IR高電平時長
{
delay(1);
N++;
if (N>=30) {EA=1;return;}
}
IRCOM[j]=IRCOM[j] >> 1;
if (N>=8) {IRCOM[j] = IRCOM[j] | 0x80;}
N=0;
}//end for k
}//end for j

if (IRCOM[2]!=~IRCOM[3]) {EA=1;return;}
IRCOM[5]=IRCOM[2] & 0x0F;
IRCOM[6]=IRCOM[2] & 0xF0;
IRCOM[6]=IRCOM[6] >> 4;
beep();
EA = 1;

}

void IR_SHOW()
{
P0 = table[IRCOM[5]];
GEWEI = 0;
SHIWEI = 1;
delay1(4);
P0 = table[IRCOM[6]];
SHIWEI = 0;
GEWEI = 1;
delay1(4);
}

void beep()
{
unsigned char i;
for (i=0;i<100;i++)
{
delay(5);
BEEP=!BEEP;
}
BEEP=1;
}

void delay(unsigned char x)//x*0.14MS
{
unsigned char i;
while(x--)
{
for (i = 0; i<13; i++) {}
}
}

void delay1(unsigned char ms)
{
unsigned char i;
while(ms--)
{
for(i = 0; i<120; i++)
{
_nop_();
_nop_();
_nop_();
_nop_();
}
}
}

⑦ 求這道c語言編程代碼

#include<stdio.h>

int main()

{ int n,s=0;

scanf("%d",&n);

while(n)s+=n%10,n/=10;

printf("%d ",s);

return 0;

}

⑧ 誰能給我個C語言程序源代碼。

這是我做的課程設計,圖像動畫!你可以看看!
/* Note:Your choice is C IDE */
#include "graphics.h"
#include "stdlib.h"
main()
{
int driver=DETECT ,mo;
void qp();
void hu();
void dong1();
void tuzi();
initgraph(&driver,&mo," ");
qp();
hu();
dong1();
qp();
tuzi();

}
void qp()
{
int i;
setcolor(13);
setbkcolor(11);
for(i=0;i<=500;i++)
{
circle(320,240,i);
delay(5000);
}
cleardevice();
}
void hu()
{
int i,j;
setcolor(7);
setbkcolor(11);

arc(550,73,91,283,65);
arc(600,68,130,240,80);/*月亮*/
setfillstyle(1,15);
floodfill(490,70,7);
for(i=50;i<=400;i+=20)
for(j=50;j<=150;j+=12)
circle(i,j,1);

moveto(545,20);
lineto(550,30);
lineto(560,35);
lineto(550,40);
lineto(545,50);
lineto(540,40);
lineto(530,35);
lineto(540,30);
lineto(545,20);/*星星*/
do
{
i=random(15);
setfillstyle(1,i);
floodfill(545,35,7);

}while(!kbhit());

fillellipse(240,230,50,40);/*頭邊框*/
setfillstyle(1,14);
floodfill(240,230,7);
fillellipse(240,238,6,5);/*鼻子*/
setfillstyle(1,6);
floodfill(240,238,7);
fillellipse(228,233,6,9);/*右眼眶*/
fillellipse(252,233,6,9);/*左眼眶*/
setfillstyle(1,15);
floodfill(228,233,7);
floodfill(252,233,7);
circle(227,231,2);/*右眼球*/
setfillstyle(1,8);
floodfill(227,231,7);
circle(250,231,2);/*左眼球*/
setfillstyle(1,8);
floodfill(250,231,7);
arc(234,244,160,331,8);/*右半邊面鼻子*/
arc(246,244,207,370,8);/*左半邊面鼻子*/
ellipse(240,250,181,359,4,9);/*嘴*/
setfillstyle(1,12);
floodfill(240,254,7);
line(254,244,268,248);
line(254,242,267,238);/*右邊胡須*/
line(226,244,214,248);
line(226,242,212,238);/*左邊胡須*/
line(225,215,255,215);
line(230,207,250,207);
line(233,199,247,199);
line(240,215,240 ,199);/*王字*/
arc(205,195,1,242,16);
setfillstyle(1,14);
floodfill(205,195,7);
arc(275,195,-64,176,16);/*耳朵*/
floodfill(275,195,7);

ellipse(235,320,112,422,40,60);/*身體*/
setfillstyle(1,14);
floodfill(235,320,7);
ellipse(240,230,289,329,65,50);
circle(292,250,8.9);/*左手*/
setfillstyle(1,14);
floodfill(292,250,7);
ellipse(243,230,200,246,80,50);
ellipse(240,215,200,246,75,50);
circle(165,240,9);/*右手*/
setfillstyle(1,14);
floodfill(165,240,7);
ellipse(190,250,190,284,60,110);/*尾巴*/

fillellipse(267,380,30,12);
setfillstyle(1,11);
floodfill(270,380,7);
arc(314,398,83,190,30);
arc(295,380,240,391,25);/*前腿*/
setfillstyle(1,5);
floodfill(300,398,7);
arc(223,408,101,150,38);
arc(197,365,266,338,35);
arc(160,405,-23,74,35);
arc(195,390,138,267,30);/*後腿*/
setfillstyle(1,5);
floodfill(180,400,7);

line(160,240,110,150);
line(110,150,35,200);
line(35,200,60,240);
line(60,240,133,190);
outtextxy(50,195,"Beybey");/*旗*/
setfillstyle(1,12);
floodfill(100,160,7);
setfillstyle(1,9);
floodfill(10,10,7);
getch();
closegraph();

}
void dong1()
{
void *buffer;
int size,i;
size=imagesize(30,140,320,430);
buffer=malloc(size);
getimage(30,140,320,430,buffer);
for(i=6;i<=640;i+=5)
putimage(i,140,buffer,COPY_PUT);
}
void tuzi()
{

int color;
setcolor(14);
arc(0,0,270,360,80);
line(90,20,150,10);
line(80,40,150,60);
line(65,70,130,115);
line(25,95,55,165);/*太陽*/
setfillstyle(1,14);
floodfill(0,0,14);

setbkcolor(11);
setcolor(7);
fillellipse(135,320,60,80);/*身體*/
setfillstyle(1,15);
floodfill(135,320,7);
fillellipse(138,305,7,4);/*嘴*/
setfillstyle(1,8);
floodfill(138,305,7);
circle(121,290,2);
circle(151,287,2);/*眼睛*/
setfillstyle(1,4);
floodfill(121,290,7);
floodfill(151,287,7);
line(156,303,164,300);
line(157,308,165,305);
line(158,312,168,310);
line(117,304,110,300);
line(115,310,108,307);
line(116,313,107,315); /*胡須*/

ellipse(115,339,250,450,16,6);/*右手*/
fillellipse(122,405,17,9);/*後腳*/
setfillstyle(1,15);
floodfill(122,405,7);
arc(197,390,86,209,25);
arc(163,370,293,365,35);/*前腳*/
setfillstyle(1,15);
floodfill(185,385,7);
ellipse(193,320,255,448,16,6);/*左手*/
setfillstyle(1,15);
floodfill(200,320,7);
arc(78,340,133,285,20);
arc(65,347,60,95,20);/*尾巴*/
setfillstyle(1,15);
floodfill(73,340,7);
ellipse(118,275,7,111,55,120);
ellipse(80,275,16,106,55,120);
arc(265,170,177,210,200);/*耳朵*/
setfillstyle(1,15);
floodfill(121,220,7);
setfillstyle(1,15);
floodfill(151,220,7);

line(205,320,245,170);
fillellipse(245,110,50,67);/*氣球*/
setfillstyle(1,12);
floodfill(245,110,7);
arc(80,140,230,265,160 );
arc(80,190,230,258,160 );
arc(80,240,230,258,160 );/*風*/
setcolor(2);
arc(540,430,90,180,70);
arc(400,430,0,100,70);
arc(610,430,130,180,140);
arc(350,430,0,50,120);

while(!kbhit())
for(color=1;color<=15;color++)
{
setcolor(color);
outtextxy(220,100,"Hello");
}

getch();
closegraph();
}

⑨ 用C語言實現如下代碼

用正則表達式吧,先匹配所有的[+-]加上數字開頭的後面是x^最後是數字的
前面的[+-]加上數字就是系數,後面的數字是階
同樣去匹配x
最後去匹配單純的[+-]加上數字
不管是幾階方程的系數都可以正確匹配出來

⑩ 求下題C語言程序完整代碼!!!

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

void Sort(char *q[],int n)
{
int i,j;
char *temp;

for(i = 0; i< n-1; i++)
for(j = i+1; j< n; j++)
{
if(strcmp(q[i],q[j]) > 0)
{
temp = q[i];
q[i] = q[j];
q[j] = temp;
}
}

}

int main()
{
char * p[3];
int i;
for(i = 0; i < 3; i++)
{
p[i]=(char*)malloc(100);//動態內存分配

scanf("%s",p[i]);//注意回車
}

Sort(p,3);

for(i = 0; i < 3; i++)
printf("%s\n",p[i]);

return 0;
}

OK啦 有問題繼續。。。