
four minutes ago !
I'm the first, isn't it?

-----------------
Your last example cv_cam_pbdatabase.pb is exellent. I'm using SQLite too, it's small and fast.
I think so, but since it was your idea in the first place - it's only fitting.four minutes ago !
I'm the first, isn't it?
It's my bad englishJHPJHP wrote:...I think so, but since it was your idea...
The example cv_cam_pbdatabase.pb uses a Procedure that does just that - See: includes/pb_procedures.pbi...how pass a frame to pb_image
Code: Select all
ImportImage(*image, name.s, extension.s = ".jpg")
;...
;encode image to memory (OpenCV)
*mat.CvMat = cvEncodeImage(extension, *image, @params)
;load image from memory (PureBasic)
pbimage = CatchImage(#PB_Any, *mat\ptr)
;...
Code: Select all
; OpenCV funsctions - Examples call trees.
;
Structure funcfile
cvFunc.s
exampleName.s
EndStructure
Dim pos.l(2)
Dim funcInFile.s(1)
fifcntr.l=0
Dim funcList.s(1)
cntr.l=0
Dim exampleList.s(1)
fecntr.l=0
Dim FuncExampleList.funcfile(1)
fflcntr.l=0
Dim exmpls.s(1)
exmplscntr.l = 0
; Path to OpenCV examples
Directory$ = "d:\00_ex";
; Path to OpenCV includes
ReadFile(0, "d:\00\includes\cv_functions.pbi")
CreateFile(1, "cvFuncList.txt")
While Not Eof(0)
str$ = ReadString(0)
If Not FindString(str$, "cv")
Continue
EndIf
If FindString(str$, "cv_")
Continue
EndIf
startpos = FindString(str$, "cv")
func$=Trim(Mid(str$, startpos))
pos(0) = FindString(func$, ".")
pos(1) = FindString(func$, "(")
pos(2) = FindString(func$, "-")
SortArray(pos(),#PB_Sort_Ascending)
If pos(0) <> 0
pos = pos(0)
ElseIf pos(1) <> 0
pos = pos(1)
Else
pos = pos(2)
EndIf
If pos
ReDim funcList(cntr + 1)
funcList(cntr) = Left(func$, pos-1)
cntr + 1
EndIf
Wend
cntr - 1
ReDim funcList(cntr)
SortArray(funcList(),#PB_Sort_Ascending + #PB_Sort_NoCase)
prevfunc2$ = ""
Dim funcListR.s(1)
cntrR.l=0
For i=0 To cntr
func2$ = funcList(i)
If func2$ <> prevfunc2$
WriteStringN(1,func2$)
prevfunc2$ = func2$
funcListR(cntrR) = func2$
cntrR+1
ReDim funcListR(cntrR)
EndIf
Next
CloseFile(0)
CloseFile(1)
CreateFile(2, "ExamplesList.txt")
CreateFile(3, "ExampleFuncList.txt")
If ExamineDirectory(4, Directory$, "*.*")
Debug "Files found:"
While NextDirectoryEntry(4)
If DirectoryEntryType(4) = #PB_DirectoryEntry_File
Debug DirectoryEntryName(4)
WriteStringN(2, DirectoryEntryName(4))
res = ReadFile(5, Directory$+"\"+DirectoryEntryName(4))
WriteStringN(3, DirectoryEntryName(4)+":")
ReDim funcInFile(1)
fifcntr.l=0
While Not Eof(5)
fileline$ = ReadString(5)
For k=0 To cntr
If FindString(fileline$, funcList(k), 1, #PB_String_NoCase)
ReDim funcInFile(fifcntr+1)
funcInFile(fifcntr) = funcList(k)
fifcntr + 1
EndIf
Next k
Wend
CloseFile(5)
fifcntr - 1
ReDim funcInFile(fifcntr)
SortArray(funcInFile(),#PB_Sort_Ascending + #PB_Sort_NoCase)
prevfunc3$ = ""
For m=0 To fifcntr
func3$ = funcInFile(m)
If func3$ <> prevfunc3$
WriteStringN(3," "+func3$)
prevfunc3$ = func3$
ReDim FuncExampleList(fflcntr + 1)
FuncExampleList(fflcntr)\cvFunc = func3$
FuncExampleList(fflcntr)\exampleName = DirectoryEntryName(4)
fflcntr + 1
EndIf
Next
WriteStringN(3," ")
exampleList(fecntr) = DirectoryEntryName(4)
fecntr + 1
ReDim exampleList(fecntr)
EndIf
Wend
FinishDirectory(4)
EndIf
CloseFile(2)
CloseFile(3)
CreateFile(5, "FuncExampleList.txt")
ReDim FuncExampleList(fflcntr - 1)
SortStructuredArray(FuncExampleList(), #PB_Sort_NoCase+#PB_Sort_Ascending, OffsetOf(funcfile\cvFunc), TypeOf(funcfile\cvFunc))
prevfunc4$ = ""
For p=0 To cntrR
func4$ = funcListR(p)
exmplscntr = 0
ReDim exmpls(0)
For q = 0 To fflcntr-1
If Trim(FuncExampleList(q)\cvFunc) = Trim(func4$)
exmpls(exmplscntr) = FuncExampleList(q)\exampleName
exmplscntr + 1
ReDim exmpls(exmplscntr)
EndIf
If Trim(FuncExampleList(q)\cvFunc) > Trim(func4$)
If exmplscntr > 1
ReDim exmpls(exmplscntr-1)
SortArray(exmpls(),#PB_Sort_Ascending + #PB_Sort_NoCase)
EndIf
WriteStringN(5,funcListR(p)+":")
For r = 0 To exmplscntr - 1
WriteStringN(5," "+exmpls(r))
Next r
WriteStringN(5," ")
Break
EndIf
Next q
Next p
CloseFile(5)
Debug "========================================="
Debug "Search completed."
-----------------------------------------There are many openCV function not used in examples, so it is possible to write more examples
Code: Select all
SetBkColor_(window_handle, 0)
I need more information on what you're trying to do.how i know the number of capture device in the computer