pb调用高清摄像头黑屏

降蛇伏猫喵 2019-07-04 03:45:56
如题。在程序中用pb调用摄像头拍照并保存到数据库,原摄像头是成功的。但换了高清摄像头后,摄像头界面直接黑屏。代码如下:
通过capCreateCaptureWindowA打开摄像头。

string lpszName
ulong l1
l1=handle(p_1)
lpszName='攝像頭界面...'
lhand=capCreateCaptureWindowA(lpszName,262144+12582912+1073741824 + 268435456 ,-5,-30,320,240,l1,0)
if lhand <> 0 then
send(lhand, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0)
send(lhand, WM_CAP_SET_CALLBACK_ERROR, 0, 0)
send(lhand, WM_CAP_SET_CALLBACK_STATUSA, 0, 0)
send(lhand, WM_CAP_DRIVER_CONNECT, 0, 0)
send(lhand, WM_CAP_SET_SCALE, 1, 0)
send(lhand, WM_CAP_SET_PREVIEWRATE, 66, 0)
send(lhand, WM_CAP_SET_OVERLAY, 1, 0)
send(lhand, WM_CAP_SET_PREVIEW, 1, 0)
end if

请教该如何解决此问题?谢谢
...全文
1164 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
娜时莫尘 2020-12-23
  • 打赏
  • 举报
回复
引用 16 楼 天空的云彩 的回复:
我遇到同样的问题,怎么办? 像素低的摄像头可以用,高清的摄像头则打开黑屏!!

您那可以了吗,在win10上打开摄像头就是黑屏,,,,什么情况
娜时莫尘 2020-12-23
  • 打赏
  • 举报
回复
您好,您那可以正常调用摄像头吗,我这调用摄像头黑屏,保存的照片是0K,打不开
longdrang 2020-05-06
  • 打赏
  • 举报
回复
先试下保存的图片是否可以用图片查看工具打开?
天空的云彩 2020-04-14
  • 打赏
  • 举报
回复
我遇到同样的问题,怎么办? 像素低的摄像头可以用,高清的摄像头则打开黑屏!!
ganzhenyu 2020-02-18
  • 打赏
  • 举报
回复
https://download.csdn.net/download/ganzhenyu/11967280 可以试试我这个
  • 打赏
  • 举报
回复
你用的那方法,你是调用后,关闭程序的时候没有关闭连接吧;然后导致以后打开多是黑屏了;
qj_198127 2020-02-16
  • 打赏
  • 举报
回复
不行用个佳能提供的免费控件,windows带的不稳定
WMERP 2019-07-16
  • 打赏
  • 举报
回复
string ls_photofile,ls_name string ls_named integer li_value long ll_pos,ll_filelen //选择照片文件 li_value = GetFileOpenName("选择图片文件", & + ls_photofile, ls_named, "图片文件", & + "BMP Files (*.BMP),*.BMP," & + "JPG Files (*.JPG),*.JPG") if ls_photofile='' or isnull(ls_photofile) then return 0 ll_filelen = FileLength(ls_photofile) IF ll_filelen > 327650 THEN Messagebox('出错','文件超出最大限制320K,建议使用大小320K以下图片!') return 0 end if sle_photo.text = ls_photofile ls_name=ls_photofile ll_pos=pos(ls_name,'\') do while ll_pos>0 ls_name=right(ls_name,len(ls_name) - ll_pos) ll_pos=pos(ls_name,'\') loop sle_name.text=ls_name integer li_fnum,li_set long ll_bytes blob Emp_Id_Pic li_fnum = FileOpen( ls_photofile , StreamMode!) ll_bytes = FileReadEx(li_fnum, Emp_Id_Pic) if isnull(ll_bytes) then ll_bytes=-1 il_picread=ll_bytes if il_picread>0 then ib_pic=Emp_Id_Pic else return 0 end if li_set=p_1.setpicture(ib_pic) if isnull(li_set) then li_set=-1 if li_set<=0 then il_picread=0 return 0 end if //数据库中调用 selectblob erp_img into :lb_picture from erp_img_setup where img_id=:ll_no; p_1.setpicture(lb_picture)
WMERP 2019-07-16
  • 打赏
  • 举报
回复
这个直接用图像控件就可以的了,不管是上传上去的BLOB数据还是文件直接setpicture方法就行
xiaozhe_song 2019-07-15
  • 打赏
  • 举报
回复
换个方法,浏览的时候,先从数据库拿出来,放临时位置,然后用图片控件加载。
降蛇伏猫喵 2019-07-15
  • 打赏
  • 举报
回复
引用 6 楼 xiaozhe_song 的回复:
啥需求,我有个调用摄像头的ocx,OpenCV封装。


需求是通过摄像头拍照身份证保存到本机上,并显示在ole控件中,确认无误后保存到sqlserver里。我现在可以做到保存到本机上了,但ole控件上只显示图片名。如图
xiaozhe_song 2019-07-09
  • 打赏
  • 举报
回复
啥需求,我有个调用摄像头的ocx,OpenCV封装。
降蛇伏猫喵 2019-07-06
  • 打赏
  • 举报
回复
回复2楼,我重新从网上下载了你说的dll文件,也没有成功,我的引用外部文件如下:

function ulong getwindowdc (ulong hwnd) library "user32.dll" alias for "GetWindowDC"
function ulong capcreatecapturewindowa (string lpszwindowname,ulong dwstyle,long x,long y,long nwidth,long nheight,ulong parentwin,long nid) library "AVICAP32.DLL" alias for "capCreateCaptureWindowA;Ansi"
function integer out_num (integer irow) library "getbitmap.dll" alias for "out_num"
function integer getbitmapfromscreen (string filename) library "getbitmap.dll" alias for "GetBitmapFromScreen;Ansi"
function integer getbitmapfromwindow (string lpfilename,ulong hwdc,integer x,integer y,integer w,integer h,integer zoom) library "getbitmap.dll" alias for "GetBitmapFromWindow;Ansi"
function integer grabimage (ulong hwndc,string path) library "getbitmap.dll" alias for "GrabImage;Ansi"
function integer stopkinescope (ulong hwndc) library "getbitmap.dll" alias for "StopKinescope"
function integer kinescope (ulong hwndc,string filename) library "getbitmap.dll" alias for "Kinescope;Ansi"
降蛇伏猫喵 2019-07-06
  • 打赏
  • 举报
回复
回复1楼,试过了不行。我的代码如下:
string lpszName
ulong l1
l1=handle(p_1)
lpszName='攝像頭界面...'
lhand=capCreateCaptureWindowA(lpszName,262144+12582912+1073741824 + 268435456 ,-5,-30,320,240,l1,0)
if lhand <> 0 then
send(lhand, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0)
send(lhand, WM_CAP_SET_CALLBACK_ERROR, 0, 0)
send(lhand, WM_CAP_SET_CALLBACK_STATUSA, 0, 0)
send(lhand, WM_CAP_DRIVER_CONNECT, 0, 0)
send(lhand, WM_CAP_SET_SCALE, 1, 0)
send(lhand, WM_CAP_SET_PREVIEWRATE, 66, 0)
send(lhand, WM_CAP_SET_OVERLAY, 1, 0)
send(lhand, WM_CAP_SET_PREVIEW, 1, 0)
end if
WMERP 2019-07-06
  • 打赏
  • 举报
回复
你最好安装了高清的驱动和对应的摄像软件,再搜索一下getbitmap.dll ,试试用下他们自带的
WMERP 2019-07-05
  • 打赏
  • 举报
回复
这个是要用到getbitmap.dll 文件的,是不是文件版本不一样的
WMERP 2019-07-05
  • 打赏
  • 举报
回复
lhand=capCreateCaptureWindowA(lpszName,262144+12582912+1073741824 + 268435456,UnitsToPixels(0, XUnitsToPixels!),UnitsToPixels(0, YUnitsToPixels!),UnitsToPixels(parent.width - 25, XUnitsToPixels!),UnitsToPixels(1890, YUnitsToPixels!),l1,0)

680

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder API 调用
社区管理员
  • API 调用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧