[squeak-dev] The Trunk: MorphicExtras-mt.286.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Mar 17 14:17:05 UTC 2021


Marcel Taeumel uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-mt.286.mcz

==================== Summary ====================

Name: MorphicExtras-mt.286
Author: mt
Time: 17 March 2021, 3:17:02.529151 pm
UUID: 93ba8465-ae64-4145-bf66-6b9918a9b9d5
Ancestors: MorphicExtras-mt.285

Complements EToys-mt.435

=============== Diff against MorphicExtras-mt.285 ===============

Item was changed:
+ SystemOrganization addCategory: #'MorphicExtras-WebCam'!
  SystemOrganization addCategory: #'MorphicExtras-AdditionalMorphs'!
  SystemOrganization addCategory: #'MorphicExtras-AdditionalSupport'!
  SystemOrganization addCategory: #'MorphicExtras-AdditionalWidgets'!
  SystemOrganization addCategory: #'MorphicExtras-Books'!
  SystemOrganization addCategory: #'MorphicExtras-Demo'!
  SystemOrganization addCategory: #'MorphicExtras-EToy-Download'!
  SystemOrganization addCategory: #'MorphicExtras-Exceptions'!
  SystemOrganization addCategory: #'MorphicExtras-Flaps'!
  SystemOrganization addCategory: #'MorphicExtras-GeeMail'!
  SystemOrganization addCategory: #'MorphicExtras-Leds'!
  SystemOrganization addCategory: #'MorphicExtras-Navigators'!
  SystemOrganization addCategory: #'MorphicExtras-Obsolete'!
  SystemOrganization addCategory: #'MorphicExtras-Palettes'!
  SystemOrganization addCategory: #'MorphicExtras-PartsBin'!
  SystemOrganization addCategory: #'MorphicExtras-Postscript Canvases'!
  SystemOrganization addCategory: #'MorphicExtras-Postscript Filters'!
  SystemOrganization addCategory: #'MorphicExtras-SoundInterface'!
  SystemOrganization addCategory: #'MorphicExtras-SqueakPage'!
  SystemOrganization addCategory: #'MorphicExtras-Support'!
  SystemOrganization addCategory: #'MorphicExtras-Text Support'!
  SystemOrganization addCategory: #'MorphicExtras-Undo'!
  SystemOrganization addCategory: #'MorphicExtras-Widgets'!

Item was added:
+ Object subclass: #CameraInterface
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'MorphicExtras-WebCam'!
+ 
+ !CameraInterface commentStamp: 'eem 10/16/2020 10:53' prior: 0!
+ CameraInterface: Simple cross-platform webcam access interface adapted from MIT Scratch. Changes made so that different cameras can be tested when more than one is connected, and so that the interface is simpler and may be interrupt-driven.
+ 
+ [| form |
+ form := Form extent: 352 @ 288 depth: 32.
+ CameraInterface
+ 	openCamera: 1 width: form width height: form height;
+ 	trySetSemaphoreForCamera: 1.
+ [Sensor noButtonPressed] whileTrue:
+ 	[CameraInterface
+ 		waitForNextFrame: 1 timeout: 2000;
+ 		getFrameForCamera: 1 into: form bits.
+ 	 form displayAt: Sensor cursorPoint]] ensure: [CameraInterface closeCamera: 1]
+ 
+ Copyright (c) 2009 Massachusetts Institute of Technology
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.!

Item was added:
+ ----- Method: CameraInterface class>>camera:framesDo:while: (in category 'utilities') -----
+ camera: cameraNum framesDo: aBlock while: whileBlock
+ 	"Evaluate aBlock every time a frame becomes available.  Answer a tuple of frames per second and number of 16ms delays per second.
+ 	 Be destructive; use only one bitmap, overwriting its contents with each successive frame.
+ 	 It is the sender's responsibility to open and close the camera."
+ 	| form bitmap delay start duration frameCount delayCount |
+ 	form := Form
+ 				extent: (self frameExtent: cameraNum)
+ 				depth: 32.
+ 	bitmap := form bits.
+ 	delay := Delay forMilliseconds: (1000 / 60) asInteger. "60 fps is fast"
+ 	start := Time utcMicrosecondClock.
+ 	frameCount := delayCount := 0.
+ 	[[(self camera: cameraNum getParam: 1) <= 0] whileTrue:
+ 		[delay wait. delayCount := delayCount + 1].
+ 	 self getFrameForCamera: cameraNum into: bitmap.
+ 	 frameCount := frameCount + 1.
+ 	 aBlock value: form.
+ 	 whileBlock value] whileTrue.
+ 	^{ frameCount * 1.0e6 / (duration := Time utcMicrosecondClock - start).
+ 		delayCount * 1.0e6 / duration }
+ 
+ 	"| cameraNum |
+ 	 self openCamera: (cameraNum := 1) width: 640 height: 480.
+ 	 self waitForCameraStart: cameraNum.
+ 	 [self camera: cameraNum framesDo: [:bitmap| bitmap display] while: [Sensor noButtonPressed]] ensure:
+ 		[self closeCamera: cameraNum]"!

Item was added:
+ ----- Method: CameraInterface class>>camera:getParam: (in category 'camera ops') -----
+ camera: cameraNum getParam: paramNum
+ 	"Answer the given parameter for the given camera.
+ 		param 1 is the frame count, the number of frames grabbed since the last send of getFrameForCamera:into:
+ 		param 2 is the size of the bitmap in bytes required for an image"
+ 
+ 	<primitive: 'primGetParam' module: 'CameraPlugin' error: ec>
+ 	^nil
+ !

Item was added:
+ ----- Method: CameraInterface class>>camera:setSemaphore: (in category 'camera ops') -----
+ camera: cameraNum setSemaphore: semaphoreIndex
+ 	"Set an external semaphore index through which to signal that a frame is available.
+ 	 Fail if cameraNum does not reference an open camera, or if the platform does not
+ 	 support interrupt-driven frame receipt."
+ 	<primitive: 'primSetCameraSemaphore' module: 'CameraPlugin' error: ec>
+ 	^self primitiveFailed!

Item was added:
+ ----- Method: CameraInterface class>>cameraDevices (in category 'utilities') -----
+ cameraDevices
+ 	"CameraInterface cameraDevices"
+ 	^Array streamContents:
+ 		[:s| | i |
+ 		i := 1.
+ 		[(self cameraName: i)
+ 			ifNotNil: [:cameraName| s nextPut: cameraName. true]
+ 			ifNil: [false]] whileTrue: [i := i + 1]]!

Item was added:
+ ----- Method: CameraInterface class>>cameraGetSemaphore: (in category 'camera ops') -----
+ cameraGetSemaphore: cameraNum
+ 	"Answer the external semaphore index through which to signal that a frame is available.
+ 	 Fail if cameraNum has not had a semaphore index set, or is otherwise invalid.
+ 	 Answer nil on failure for convenience."
+ 	<primitive: 'primGetCameraSemaphore' module: 'CameraPlugin' error: ec>
+ 	^nil!

Item was added:
+ ----- Method: CameraInterface class>>cameraIsAvailable (in category 'camera ops') -----
+ cameraIsAvailable
+ 	"Answer true if at least one camera is available."
+ 
+ 	^(self cameraName: 1) notNil
+ !

Item was added:
+ ----- Method: CameraInterface class>>cameraIsOpen: (in category 'camera ops') -----
+ cameraIsOpen: cameraNum
+ 	"Answer true if the camera is open."
+ 
+ 	^ (self packedFrameExtent: cameraNum) > 0
+ !

Item was added:
+ ----- Method: CameraInterface class>>cameraName: (in category 'camera ops') -----
+ cameraName: cameraNum
+ 	"Answer the name of the given camera. Answer nil if there is no camera with the given number."
+ 
+ 	<primitive: 'primCameraName' module: 'CameraPlugin'>
+ 	^ nil
+ !

Item was added:
+ ----- Method: CameraInterface class>>cameraUID: (in category 'camera ops') -----
+ cameraUID: cameraNum
+ 	"Answer the unique ID of the given camera. Answer nil if there is no camera with the given number."
+ 
+ 	<primitive: 'primCameraUID' module: 'CameraPlugin'>
+ 	^ nil
+ 
+ 	"CameraInterface cameraUID: 1"!

Item was added:
+ ----- Method: CameraInterface class>>closeCamera: (in category 'camera ops') -----
+ closeCamera: cameraNum
+ 	"Close the camera. Do nothing if it was not open. Unregister any associated semaphore."
+ 
+ 	(self cameraGetSemaphore: cameraNum) ifNotNil:
+ 		[:semaphoreIndex|
+ 		Smalltalk unregisterExternalObject: (Smalltalk externalObjectAt: semaphoreIndex ifAbsent: nil)].
+ 	self primitiveCloseCamera: cameraNum!

Item was added:
+ ----- Method: CameraInterface class>>declareCVarsIn: (in category 'translation') -----
+ declareCVarsIn: aCCodeGenerator
+ 	"self translate"
+ 
+ 	super declareCVarsIn: aCCodeGenerator.
+ 	aCCodeGenerator cExtras: '
+ #include "cameraOps.h"
+ #include <string.h>
+ '.!

Item was added:
+ ----- Method: CameraInterface class>>frameExtent: (in category 'camera ops') -----
+ frameExtent: cameraNum
+ 	"Answer the frame extent of the currently open camera, or zero if the camera isn't open."
+ 
+ 	| packedExtent |
+ 	packedExtent := self packedFrameExtent: cameraNum.
+ 	^ (packedExtent bitShift: -16) @ (packedExtent bitAnd: 16rFFFF) !

Item was added:
+ ----- Method: CameraInterface class>>getFrameForCamera:into: (in category 'camera ops') -----
+ getFrameForCamera: cameraNum into: aBitmap
+ 	"Copy a camera frame into the given Bitmap. The Bitmap should be a Form of depth 32 that is the same width and height as the current camera frame. Fail if the camera is not open or if the bitmap is not the right size. If successful, answer the number of frames received from the camera since the last call. If this is zero, then there has been no change."
+ 
+ 	<primitive: 'primGetFrame' module: 'CameraPlugin'>
+ 	^ 0!

Item was added:
+ ----- Method: CameraInterface class>>interruptDrivenVideoTest: (in category 'test') -----
+ interruptDrivenVideoTest: camNum
+ 	"A quick test of video input. Displays video on the screen until the mouse is pressed.
+ 	 Answer nil if the interrupt-driven interface is unavailable."
+ 	"self interruptDrivenVideoTest: 1"
+ 	"self interruptDrivenVideoTest: 2"
+ 	"[self interruptDrivenVideoTest: 2] fork.
+ 	  self interruptDrivenVideoTest: 1"
+ 
+ 	| semaphore height |
+ 	height := 16.
+ 	1 to: camNum - 1 do:
+ 		[:camIndex| "N.B. the of an unopened camera is 0 at 0"
+ 		height := height + (CameraInterface frameExtent: camIndex) y + 16].
+ 	(CameraInterface cameraIsOpen: camNum) ifFalse:
+ 		[(CameraInterface openCamera: camNum width: 352 height: 288) ifNil:
+ 			[self inform: 'no camera'.
+ 			 ^nil]].
+ 	semaphore := Semaphore new.
+ 	[CameraInterface camera: camNum setSemaphore: (Smalltalk registerExternalObject: semaphore)]
+ 		on: Error
+ 		do: [:err|
+ 			Smalltalk unregisterExternalObject: semaphore.
+ 			self inform: 'interrupt-driven camera interface unavailable: ', err messageText.
+ 			^nil].
+ 	[| f n startTime frameCount msecs fps |
+ 	 [semaphore wait.
+ 	 "N.B. the frame extent may not be known until the delivery of the first frame.
+ 	  So we have to delay initialization."
+ 	  startTime ifNil:
+ 		[(self frameExtent: camNum) x = 0 ifTrue: [self inform: 'no camera'. ^nil].
+ 		 f := Form extent: (CameraInterface frameExtent: camNum) depth: 32.
+ 		 frameCount := 0.
+ 		 startTime := Time millisecondClockValue].
+ 	  Sensor anyButtonPressed] whileFalse:
+ 		[n := CameraInterface getFrameForCamera: camNum into: f bits.
+ 		n > 0 ifTrue:
+ 			[frameCount := frameCount + 1.
+ 			 f displayAt: 16 @ height]].
+ 	 msecs := Time millisecondClockValue - startTime.
+ 	 fps := (frameCount * 1000) // msecs.
+ 	 ^(CameraInterface cameraName: camNum), ': ', frameCount printString, ' frames at ', fps printString, ' frames/sec']
+ 		ensure:
+ 			[CameraInterface closeCamera: camNum.
+ 			 Smalltalk unregisterExternalObject: semaphore.
+ 			 Sensor waitNoButton]!

Item was added:
+ ----- Method: CameraInterface class>>openCamera:width:height: (in category 'camera ops') -----
+ openCamera: cameraNum width: frameWidth height: frameHeight
+ 	"Open the given camera requesting the given frame dimensions. The camera number is usually 1 since you typically have only one camera plugged in. If the camera does not support the exact frame dimensions, an available frame size with width >= the requested width is selected."
+ 
+ 	<primitive: 'primOpenCamera' module: 'CameraPlugin'>
+ 	^ nil
+ !

Item was added:
+ ----- Method: CameraInterface class>>packedFrameExtent: (in category 'camera ops') -----
+ packedFrameExtent: cameraNum
+ 	"Answer the extent of the currently open camera packed in an integer. The top 16 bits are the width, the low 16 bits are the height. Answer zero if the camera isn't open."
+ 
+ 	<primitive: 'primFrameExtent' module: 'CameraPlugin'>
+ 	^ 0
+ !

Item was added:
+ ----- Method: CameraInterface class>>primitiveCloseCamera: (in category 'private-primitives') -----
+ primitiveCloseCamera: cameraNum
+ 	"Close the camera. Do nothing if it was not open except answering nil."
+ 
+ 	<primitive: 'primCloseCamera' module: 'CameraPlugin'>
+ 	^nil!

Item was added:
+ ----- Method: CameraInterface class>>trySetSemaphoreForCamera: (in category 'utilities') -----
+ trySetSemaphoreForCamera: camNum
+ 	"Attempt to set a semaphore to be signalled when a frame is available.
+ 	 Fail silently.  Use e.g. waitForCameraStart: or waitForNextFrame: to
+ 	 access the semaphore if available."
+ 	| semaphore |
+ 	Smalltalk registerExternalObject: (semaphore := Semaphore new).
+ 	[CameraInterface camera: camNum setSemaphore: semaphore]
+ 		on: Error
+ 		do: [:err|
+ 			Smalltalk unregisterExternalObject: semaphore]!

Item was added:
+ ----- Method: CameraInterface class>>videoTest: (in category 'test') -----
+ videoTest: camNum
+ 	"A quick test of video input. Displays video on the screen until the mouse is pressed."
+ 	"self videoTest: 1"
+ 	"self videoTest: 2"
+ 
+ 	| f n startTime frameCount msecs fps |
+ 	(CameraInterface openCamera: camNum width: 320 height: 240) ifNil: [^ self inform: 'no camera'].
+ 	self waitForCameraStart: camNum.
+ 	(self frameExtent: camNum) x = 0 ifTrue: [^ self inform: 'no camera'].
+ 	f := Form extent: (CameraInterface frameExtent: camNum) depth: 32.
+ 	frameCount := 0.
+ 	startTime := nil.
+ 	[Sensor anyButtonPressed] whileFalse: [
+ 		n := CameraInterface getFrameForCamera: camNum into: f bits.
+ 		n > 0 ifTrue: [
+ 			startTime ifNil: [startTime := Time millisecondClockValue].
+ 			frameCount := frameCount + 1.
+ 			f display]].
+ 	Sensor waitNoButton.
+ 	msecs := Time millisecondClockValue - startTime.
+ 	CameraInterface closeCamera: camNum.
+ 	fps := (frameCount * 1000) // msecs.
+ 	^ frameCount printString, ' frames at ', fps printString, ' frames/sec'!

Item was added:
+ ----- Method: CameraInterface class>>waitForCameraStart: (in category 'utilities') -----
+ waitForCameraStart: camNum
+ 	"Wait for the camera to get it's first frame (indicated by a non-zero frame extent. Timeout after two seconds."
+ 	"self waitForCameraStart: 1"
+ 
+ 	| startTime |
+ 	(self cameraGetSemaphore: camNum) ifNotNil:
+ 		[:semaphoreIndex|
+ 		(Smalltalk externalObjectAt: semaphoreIndex ifAbsent: [self error: 'seriously?!!?!!?!!?']) wait.
+ 		^self].
+ 	startTime := Time utcMicrosecondClock.
+ 	[(self packedFrameExtent: camNum) > 0 ifTrue: [^ self].
+ 	 (Time utcMicrosecondClock - startTime) < 2000000] whileTrue:
+ 		[(Delay forMilliseconds: 50) wait]!

Item was added:
+ ----- Method: CameraInterface class>>waitForNextFrame:timeout: (in category 'utilities') -----
+ waitForNextFrame: camNum timeout: timeoutms
+ 	"Wait for the camera to get it's first frame (indicated by a non-zero frame extent. Timeout after two seconds."
+ 	"self waitForNextFrame: 1 timeout: 2000"
+ 
+ 	| now timeoutusecs |
+ 	(self cameraGetSemaphore: camNum) ifNotNil:
+ 		[:semaphoreIndex|
+ 		(Smalltalk externalObjectAt: semaphoreIndex ifAbsent: [self error: 'seriously?!!?!!?!!?']) waitTimeoutMSecs: timeoutms.
+ 		^self].
+ 	now := Time utcMicrosecondClock.
+ 	timeoutusecs := timeoutms * 1000.
+ 	[(self camera: camNum getParam: 1) > 0 ifTrue: [^self].
+ 	 (Time utcMicrosecondClock - now) < timeoutusecs] whileTrue:
+ 		[(Delay forMilliseconds: 50) wait]!

Item was added:
+ RectangleMorph subclass: #WebCamMorph
+ 	instanceVariableNames: 'camNum camIsOn frameExtent displayForm resolution useFrameSize captureDelayMs showFPS framesSinceLastDisplay lastDisplayTime fps orientation'
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'MorphicExtras-WebCam'!
+ 
+ !WebCamMorph commentStamp: '<historical>' prior: 0!
+ INTRODUCTION
+ =========
+ 
+ WebCamMorph together with CameraPlugin (originally from MIT Scratch) provides an easy and cross platform way to use webcam input in Squeak and Etoys. The first version has been created specifically with Etoys in mind. To view a live feed simply drag a "WebCam" tile from the "WebCam" category in the objects tool. Open up a viewer on the morph and display the "camera settings" category to explore the following basic settings:
+ 
+ 	"camera is on": turn the camera on/off.
+ 
+ 	"camera number": usually the default of "1" is ok but if you have more than one camera connected then adjust between 1 and 9 for other instances of WebCamMorph.
+ 
+ 	"max fps": leave as is for now. It is unusual for webcams to capture at higher than 30fps. See later for further explanation of how fps is controlled.
+ 
+ 	"actual fps": read-only. Indicates the actual fps being achieved which can depend significantly on lighting conditions and capture resolution...
+ 
+ 	"resolution": webcams can have a range of resolutions but for simplicity three are supported: "low" (160x120), "medium" (320x240) and "high" (640x480). Adjust in good lighting to see if "actual fps" increases. 
+ 
+ 	"use frame size": the resolution used for capturing can differ from the resolution used for display. If this setting is true then WebCamMorph is resized to match the camera resolution. If false then you are free to resize it however you want (via the "resize" halo button, use shift to preserve aspect ratio)
+ 
+ 
+ Beyond viewing a live feed WebCamMorph has been designed to support different uses including simple effects, time-lapse photography, stop-motion animation, character recognition, motion detection and more complex processing of every frame for feature detection. The following information is to help you understand how and why WebCamMorph operates so you can adjust it for your particular needs.
+ 
+ 
+ "FRAMES PER SECOND", LIGHTING & CAMERA RESOLUTION
+ ==================================
+ 
+ The maximum possible frame rate depends on many factors, some of which are outside of our control. Frame rates differ between cameras and usually depend significantly on chosen resolution and lighting conditions. To ensure a balance between capturing every available frame and keeping everything else responsive, WebCamMorph dynamically adjusts the delay between capturing one frame and the next (does not apply when in "manual capture" mode, see later). 
+ 
+ WebCams often include automatic compensation for lighting conditions. In low lighting it takes significantly more time for the camera to get a picture than it does in good lighting conditions. For example 30fps may be possible with good lighting compared to 7fps in low lighting. So for best capture rates ensure you have good lighting!! 
+ 
+ Cameras have a "native" resolution at which frame rates are usually better than for other resolutions. Note though that the native resolution might be *higher*
+ than the *minimum* resolution available. It pays to experiment with different resolutions to find which one results in the highest frame rate. Use good lighting conditions when experimenting with resolutions.
+ 
+ 
+ "MANUAL CAPTURE" MODE
+ ===============
+ 
+ In simply usage WebCamMorph automatically captures a frame and displays it. To support Etoys scripting a "manual capture" mode is provided where you or your script determines when to capture, when to apply effects (or not) and when to update the display. In between these steps you can do anything you want. Note that frames rates will be lower than that in automatic capture mode and that "skip frames" (described next) will need adjusting at very low capture rates.
+ 
+ Tip: In manual mode the camera can be turned off. It will be turned on automatically when required and return to it's previous state after a frame has been captured. For capture periods of five seconds or more turning the camera off may save power, which can especially useful when running off batteries. For smaller periods leaving the camera on will avoid some delays and could help speed up webcam related scripts.
+ 
+ 
+ "SKIP FRAMES"
+ ========
+ 
+ Webcams and their drivers are typically designed for streaming live video and use internal buffering to help speed things up. At low capture rates the picture can appear to lag real-time because what you see is the next available buffer not the *latest* buffer. So for example if you capture a frame every ten seconds and there are three buffers being used then what you actually see may be thirty seconds old. We have little/no control over the number of buffers used and the actual number can vary between cameras and under different circumstances for the same camera. "skip frames" is provided to compensate for buffering so increase it when doing "manual" capturing until you see what you expect to see. Typically a setting of 8 is enough but I have had to use 20 with one particular camera in low lighting.
+ 
+ 
+ "SNAPSHOTS"
+ ========
+ 
+ Where as "capturing" is the process of getting an image from the Camera into Squeak/Etoys, a "snapshot" preserves whatever is currently displayed (which may be the captured image after effects have been applied). To store snapshots you need to designate a "holder" which at the moment can be either a "holder" morph or a "movie" morph. Create one of these before proceeding. To assign a holder open up a viewer for WebCamMorph, display the "snapshot" category and click in the box at the right of the entry called "snapshot holder". The cursor will now resemble a cross-hair and can be clicked on the target holder/movie morph. To take a single snapshot at any time click (!!) on the left of "take snapshot". In auto-capture mode WebCamMorph can also be set to take multiple consecutive snapshots . First, before turning the camera on, set a sensible limit using "snapshot limit" (to avoid using all the computers memory) then set "auto snapshot" to true. When the camera is next turned on then s
 napshots are taken for every frame until "snapshot limit" becomes zero. "snapshot limit" is automatically decremented but not reset to avoid problems (although you are free to reset it manually or via a script).
+ 
+ 
+ "EFFECTS" - WIP
+ =========
+ 
+ Similar to snapshots, a holder can be designated as the "effects holder". This holder is intended to be populated with "fx" morphs (coming soon) which will operate on captured frames prior to displaying. Stay tuned ;-)
+ 
+ 
+ CLEARING SNAPSHOT & EFFECTS HOLDERS
+ =========================
+ 
+ Keeping a link to snapshot or effects holders can tie up resources even after the target holders have been deleted and are no longer visible. To ensure this does not happen designate the WebCamMorph itself as the holder (for method see "snapshots" section above).
+ 
+ 
+ COMING SOON!!
+ =========
+ 
+ - Built-in basic effects such as brightness, contrast and hue.
+ - Image "fx" morphs for effects such as those found in MIT Scratch and many other types of effects/ image processing.
+ - More snapshot options, eg, store to file
+ - Demo projects
+ 
+ !

Item was added:
+ ----- Method: WebCamMorph class>>additionsToViewerCategories (in category 'scripting') -----
+ additionsToViewerCategories
+ 	"Answer a list of (<categoryName> <list of category specs>) pairs that characterize the phrases this kind of morph wishes to add to various Viewer categories."
+ 	^ #(
+ 
+ 	(#'camera' (
+ 		(slot resolution '160x120, 320x240, 640x480 or 1280x960' 
+ 			WebCamResolution readWrite Player getWebCamResolution Player setWebCamResolution:)
+ 		(slot orientation 'Natural (mirrored) or navtive (as from the camera' 
+ 			WebCamOrientation readWrite Player getWebCamOrientation Player setWebCamOrientation:)
+ 		(slot cameraIsOn 'Whether the camera is on/off' Boolean readWrite Player getWebCamIsOn Player setWebCamIsOn:)
+ 		(slot useFrameSize 'Resize the player to match the camera''s frame size' 
+ 			Boolean readWrite Player getUseFrameSize Player setUseFrameSize:)
+ 		(slot lastFrame 'A player with the last frame' Player readOnly	Player getLastFrame unused unused)
+ 		(slot showFPS 'Whether to show the samera''s frames per second' Boolean readWrite Player getShowFPS Player setShowFPS:)
+ 		))
+ )
+ !

Item was added:
+ ----- Method: WebCamMorph class>>allOff (in category 'accessing') -----
+ allOff
+ 	self allInstancesDo: [:each | each off].!

Item was added:
+ ----- Method: WebCamMorph class>>descriptionForPartsBin (in category 'parts bin') -----
+ descriptionForPartsBin
+ 	^ self
+ 		partName: 'Camera' translatedNoop
+ 		categories: {'Multimedia' translatedNoop}
+ 		documentation: 'Web camera player.' translatedNoop
+ 		sampleImageForm: self icon!

Item was added:
+ ----- Method: WebCamMorph class>>icon (in category 'parts bin') -----
+ icon
+ 	"Original file: imagecodericon.png"
+ 
+ 	^ (PNGReadWriter on: (Base64MimeConverter mimeDecodeToBytes: 
+ 'iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QA/wD/AP+gvaeTAAAA
+ CXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1wIECy0ZfllfzgAAAB10RVh0Q29tbWVudABD
+ cmVhdGVkIHdpdGggVGhlIEdJTVDvZCVuAAAgAElEQVR42uW7yZNsV37f9znDnTOzMrOGrPHh
+ oR7mBtAC0BPAbpJqEpQ4tNkSF3JYbdMOLWhHmOEI/wE2rFCEubFX3lgOO+wQg3bYEbQtyaRE
+ kGx2mw12kw00UOjG9F7VG+rVkDXkeO/NO57jxc33RMlaOGjvfHKRmXc4957fPHyP+Dv/zj/E
+ sdhagBYGi4MUFolFIkCCxGIRSAwIiUCCAOzynBCAQNm6uUtUWCTWSoTNUEgqdHOLfTRbCbam
+ RpFkKZ6nUQgMCmyJNGCExVpBbS3SGmorELYGSoy1CGupLUhbUloJFszyY2uohUEYS2UBarCG
+ wkgsIGyFsUZojbRGShQgmvUiEGhoFokAFFIYpBXUQiKxCGGQFuzyv0GBUGByhHARGIwpSIuS
+ dtBCGwXUGCqsUFgcjHBRtsZBUywKoqCFFBZhFIYKZfVjwhs0ippHbyix1ABIauEgLECFxCBs
+ hRVgLYBFixprGiao5VVWgMVYDQ6KZvUKg6DhKlIgl48DgUWjhEFhG7pYgRUSjcBikLJGGkuF
+ beZDkBUZ8eyalhdRlTEC0I7PxeiM3kqPoqxx3YiqzkizGLCsBC0qKaA0CCkBBcKiqBsiYxHW
+ wYoKg2iOGIm1AgtYKkrhNdIpDJYKYxWCumGlsAhbUyGRgNYIpBA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RaLT755BOSJFleN2Rvb4/f/u1/xPPPP0dZlhwfH3NwcPD42kd2oCgKer3eY2apX/vGz7zF
+ dcr2a19+fMHm5iZ7e3sAbG5uPub6I86WZUm/32dvd5dWq/XY0CRJwmg0otVq0e/3iaKIvb09
+ XNelKAqiKKIsS4oiZ3OwQasVcetWYxz7/f5jbrmuS6vVYnNz8JiLrVbTdXrEpH6/j+u6PPfc
+ cwgh6PV69Pt9xuMxRVHQarW4desWrusSRRGtVgshxONzQghc10X8zn/9n8LtK9v/+W/w/8Mh
+ /i957VpDfrfOMwAAAABJRU5ErkJggg=='
+ 	readStream) readStream) nextImage
+ !

Item was added:
+ ----- Method: WebCamMorph class>>initialize (in category 'class initialization') -----
+ initialize
+ 	"CameraMorph initialize"
+ 
+ 
+ 	
+ !

Item was added:
+ ----- Method: WebCamMorph class>>resolutionFor: (in category 'scripting') -----
+ resolutionFor: aSymbol
+ 	(#(low medium high hd) includes: aSymbol) ifFalse: [^ 320 at 240].
+ 
+ 	^ {160 @ 120. 320 @ 240. 640 @ 480. 1280 @ 960} 
+ 			at: (WebCamResolution resolutions indexOf: aSymbol)
+ !

Item was added:
+ ----- Method: WebCamMorph class>>shutDown (in category 'accessing') -----
+ shutDown
+ 	self allOff.
+ !

Item was added:
+ ----- Method: WebCamMorph class>>startUp (in category 'accessing') -----
+ startUp
+ 	"Try to bring up any instances that were on before shutdown"
+ !

Item was added:
+ ----- Method: WebCamMorph>>addCustomMenuItems:hand: (in category 'menu') -----
+ addCustomMenuItems: aMenu hand: aHandMorph 
+ 
+ 	super addCustomMenuItems: aMenu hand: aHandMorph.
+ 	aMenu
+ 		addUpdating: #cameraToggleString action: #toggleCameraOnOff;
+ 		addLine;
+ 		add: 'resolution...' translated subMenu: ([:menu |
+ 			WebCamResolution resolutions do: [:res |
+ 				menu
+ 					add: (resolution == res ifTrue: ['<on>'] ifFalse: ['<off>']), res translated
+ 					selector: #setWebCamResolution:
+ 					argument: res].
+ 			menu] value: (aMenu class new defaultTarget: aMenu defaultTarget));
+ 		add: 'orientation...' translated subMenu: ([:menu |
+ 			WebCamOrientation orientations do: [:ori |
+ 				menu
+ 					add: (orientation == ori ifTrue: ['<on>'] ifFalse: ['<off>']), ori translated
+ 					selector: #setWebCamOrientation:
+ 					argument: ori].
+ 			menu] value: (aMenu class new defaultTarget: aMenu defaultTarget));
+ 		addUpdating: #frameSizeToggleString action: #toggleUseFrameSize;
+ 		addUpdating: #showFPSToggleString action: #toggleShowFPS;
+ 		yourself
+ !

Item was added:
+ ----- Method: WebCamMorph>>cameraIsOn (in category 'accessing') -----
+ cameraIsOn
+ 	^camIsOn!

Item was added:
+ ----- Method: WebCamMorph>>cameraNumber (in category 'accessing') -----
+ cameraNumber
+ 	^camNum!

Item was added:
+ ----- Method: WebCamMorph>>cameraNumber: (in category 'accessing') -----
+ cameraNumber: anInteger
+ 	camNum ~= anInteger ifTrue:
+ 		[camNum := anInteger.
+ 		 self initializeDisplayForm]!

Item was added:
+ ----- Method: WebCamMorph>>cameraToggleString (in category 'menu') -----
+ cameraToggleString
+ 
+ 	^ camIsOn
+ 		ifTrue: ['<on>', 'turn camera off' translated]
+ 		ifFalse: ['<off>', 'turn camera on' translated].
+ 	
+ 
+ 	
+ !

Item was added:
+ ----- Method: WebCamMorph>>decreaseCaptureDelay (in category 'accessing') -----
+ decreaseCaptureDelay
+ 
+ 	captureDelayMs := (captureDelayMs - 1) min: 200.!

Item was added:
+ ----- Method: WebCamMorph>>delete (in category 'submorphs - add/remove') -----
+ delete
+ 	self off.
+ 	super delete!

Item was added:
+ ----- Method: WebCamMorph>>drawCameraImageOn: (in category 'drawing') -----
+ drawCameraImageOn: aCanvas
+ 	| scale offset |
+ 	offset :=  0 @ 0.
+ 	scale := 1 @ 1.
+ 	bounds extent = displayForm extent
+ 		ifFalse: [scale := bounds extent  / displayForm extent].
+ 	orientation == #natural
+ 		ifTrue: [
+ 			scale := scale x negated @ scale y.
+ 			offset := bounds width @ 0].
+ 	1 @ 1 = scale
+ 		ifTrue: [aCanvas drawImage: displayForm at: bounds origin + offset]
+ 		ifFalse: [aCanvas
+ 			warpImage: displayForm
+ 			transform: (MatrixTransform2x3 withScale: scale)
+ 			at: bounds origin + offset].
+ !

Item was added:
+ ----- Method: WebCamMorph>>drawFPSOn: (in category 'drawing') -----
+ drawFPSOn: aCanvas
+ 	showFPS ifFalse: [^self].
+ 	aCanvas
+ 		drawString: 'FPS: ', fps asString
+ 		at: bounds bottomLeft + (5 @ -20)
+ 		font: Preferences windowTitleFont
+ 		color: Color white!

Item was added:
+ ----- Method: WebCamMorph>>drawOn: (in category 'drawing') -----
+ drawOn: aCanvas 
+ 	camIsOn ifFalse:
+ 		[self initializeDisplayForm.
+ 		 self on].
+ 	camIsOn ifTrue:
+ 		[(CameraInterface frameExtent: camNum) ~= displayForm extent ifTrue:
+ 			[self initializeDisplayForm]].
+ 	displayForm ifNil:
+ 		[self initializeDisplayForm].
+ 	useFrameSize ifTrue: [self extent: frameExtent].
+ 	self drawCameraImageOn: aCanvas.
+ 	self drawFPSOn: aCanvas.
+ 	self drawOverlayTextOn: aCanvas!

Item was added:
+ ----- Method: WebCamMorph>>drawOverlayTextOn: (in category 'drawing') -----
+ drawOverlayTextOn: aCanvas
+ 	camIsOn ifTrue: [^self].
+ 	aCanvas
+ 		drawString: 'Camera is off' translated
+ 		at: bounds origin + (5 @ 2)
+ 		font: Preferences windowTitleFont
+ 		color: Color white.!

Item was added:
+ ----- Method: WebCamMorph>>frameSizeToggleString (in category 'menu') -----
+ frameSizeToggleString
+ 
+ 	^ (useFrameSize ifTrue: ['<on>'] ifFalse: ['<off>']), 'use frame size' translated
+ 
+ 	
+ !

Item was added:
+ ----- Method: WebCamMorph>>getLastFrame (in category 'e-toy - settings') -----
+ getLastFrame
+ 
+ 	
+ 	^ SketchMorph withForm: displayForm deepCopy!

Item was added:
+ ----- Method: WebCamMorph>>getShowFPS (in category 'e-toy - settings') -----
+ getShowFPS
+ 	^ showFPS
+ !

Item was added:
+ ----- Method: WebCamMorph>>getUseFrameSize (in category 'e-toy - settings') -----
+ getUseFrameSize
+ 	^ useFrameSize
+ !

Item was added:
+ ----- Method: WebCamMorph>>getWebCamIsOn (in category 'e-toy - settings') -----
+ getWebCamIsOn
+ 
+ 	^ camIsOn!

Item was added:
+ ----- Method: WebCamMorph>>getWebCamResolution (in category 'e-toy - settings') -----
+ getWebCamResolution
+ 	^ resolution
+ 			
+ !

Item was added:
+ ----- Method: WebCamMorph>>increaseCaptureDelay (in category 'accessing') -----
+ increaseCaptureDelay
+ 
+ 	captureDelayMs := (captureDelayMs + 1) max: 10.!

Item was added:
+ ----- Method: WebCamMorph>>initialize (in category 'initialization') -----
+ initialize
+ 	super initialize.
+ 	camNum := 1.
+ 	camIsOn := false.
+ 	showFPS := false.
+ 	captureDelayMs := 16. "stepTime"	
+ 	fps := 60. "guess."
+ 	lastDisplayTime := 0.
+ 	framesSinceLastDisplay := 0.
+ 	useFrameSize := false.
+ 	resolution := #medium.
+ 	orientation := #natural.
+ 	frameExtent := self class resolutionFor: resolution!

Item was added:
+ ----- Method: WebCamMorph>>initializeDisplayForm (in category 'initialization') -----
+ initializeDisplayForm
+ 	| cameraExtent formExtent |
+ 
+ 	cameraExtent := CameraInterface frameExtent: camNum.
+ 	cameraExtent isZero 
+ 		ifTrue: [formExtent := frameExtent]
+ 		ifFalse: [ | camRatio frameRatio |
+ 			formExtent := cameraExtent.
+ 			camRatio := cameraExtent x / cameraExtent y.
+ 			frameRatio := frameExtent x / frameExtent y.
+ 			camRatio ~= frameRatio ifTrue: [frameExtent := frameExtent x @ (frameExtent x * camRatio reciprocal)]].
+ 	displayForm := Form extent: formExtent depth: 32.
+ 	self extent: frameExtent.
+ !

Item was added:
+ ----- Method: WebCamMorph>>intoWorld: (in category 'initialization') -----
+ intoWorld: aWorld
+ 
+ 	super intoWorld: aWorld.
+ 	camIsOn ifTrue: [self on]
+ 					ifFalse:[self off].
+ 	self removeActionsForEvent: #aboutToEnterWorld.
+ 	aWorld
+ 		when: #aboutToLeaveWorld
+ 		send: #outOfWorld:
+ 		to: self
+ 		with: aWorld.!

Item was added:
+ ----- Method: WebCamMorph>>knownName (in category 'testing') -----
+ knownName
+ 
+ 	^ CameraInterface cameraName: camNum	!

Item was added:
+ ----- Method: WebCamMorph>>nextFrame (in category 'stepping and presenter') -----
+ nextFrame
+ 	
+ 	| frameCount |
+ 	frameCount := CameraInterface getFrameForCamera: camNum into: displayForm bits.
+ 	frameCount = 0 ifTrue: [self increaseCaptureDelay].
+ 	frameCount > 2 ifTrue: [self decreaseCaptureDelay].
+ 	framesSinceLastDisplay := framesSinceLastDisplay + frameCount!

Item was added:
+ ----- Method: WebCamMorph>>off (in category 'accessing') -----
+ off
+ 	self stopStepping.
+ 	camIsOn := false.
+ 	"Be careful not to close the camera if any other morphs are using the same camera."
+ 	(self class allInstances anySatisfy: [:wcm| wcm cameraNumber = camNum and: [wcm cameraIsOn]]) ifFalse:
+ 		[CameraInterface  closeCamera: camNum].
+ 	self changed
+ 	
+ 	"self allInstances select: [:wcm| wcm cameraNumber = 1 and: [wcm cameraIsOn]]"!

Item was added:
+ ----- Method: WebCamMorph>>on (in category 'accessing') -----
+ on
+ 	camIsOn ifTrue: [^true].
+ 	(CameraInterface cameraIsOpen: camNum) ifFalse:
+ 		[(CameraInterface openCamera: camNum width: frameExtent x height: frameExtent y) ifNil:
+ 			[^false]].
+ 	"The plugin/camera subsystem may end up choosing a different width and height.
+ 	 So use the width and height it has selected; it may not be what was asked for."
+ 	self initializeDisplayForm.
+ 	CameraInterface waitForCameraStart: camNum.
+ 	camIsOn := true.
+ 	self startStepping!

Item was added:
+ ----- Method: WebCamMorph>>outOfWorld: (in category 'initialization') -----
+ outOfWorld: aWorld
+ 
+ 	super outOfWorld: aWorld.
+ 	camIsOn ifTrue: [self off. camIsOn := true].
+ 	aWorld
+ 		when: #aboutToEnterWorld
+ 		send: #intoWorld:
+ 		to: self
+ 		with: aWorld.!

Item was added:
+ ----- Method: WebCamMorph>>setShowFPS: (in category 'e-toy - settings') -----
+ setShowFPS: aBoolean
+ 	showFPS := aBoolean
+ !

Item was added:
+ ----- Method: WebCamMorph>>setUseFrameSize: (in category 'e-toy - settings') -----
+ setUseFrameSize: aBoolean
+ 	useFrameSize := aBoolean!

Item was added:
+ ----- Method: WebCamMorph>>setWebCamIsOn: (in category 'e-toy - settings') -----
+ setWebCamIsOn: aBoolean
+ 	aBoolean ifTrue: [self on] ifFalse: [self off]
+ !

Item was added:
+ ----- Method: WebCamMorph>>setWebCamOrientation: (in category 'e-toy - settings') -----
+ setWebCamOrientation: aSymbol
+ 
+ 	((WebCamOrientation orientations) includes: aSymbol) ifFalse: [^ self].
+ 	orientation := aSymbol.
+ 			
+ 
+ !

Item was added:
+ ----- Method: WebCamMorph>>setWebCamResolution: (in category 'e-toy - settings') -----
+ setWebCamResolution: aSymbol
+ 	| wasOn |
+ 	"Failing silently here is awful; but that's what the code did :-("
+ 	(WebCamResolution resolutions includes: aSymbol) ifFalse: [^ self].
+ 	resolution := aSymbol.
+ 
+ 	(wasOn := camIsOn) ifTrue: [self off].
+ 	frameExtent := self class resolutionFor: aSymbol.
+ 	displayForm ifNotNil:
+ 		[displayForm := displayForm scaledToSize: frameExtent].
+ 	self updateDisplay.
+      wasOn ifTrue: [self on]
+ !

Item was added:
+ ----- Method: WebCamMorph>>showFPSToggleString (in category 'menu') -----
+ showFPSToggleString
+ 
+ 	^ (showFPS ifTrue: ['<on>'] ifFalse: ['<off>']), 'show fps' translated
+ 
+ 	
+ !

Item was added:
+ ----- Method: WebCamMorph>>step (in category 'stepping and presenter') -----
+ step
+ 	camIsOn ifFalse:[self stopStepping].
+ 	self updateDisplay.
+ 	
+ 									!

Item was added:
+ ----- Method: WebCamMorph>>stepTime (in category 'stepping and presenter') -----
+ stepTime
+ 	"Answer the desired time between steps in milliseconds"
+ 	^ captureDelayMs
+ !

Item was added:
+ ----- Method: WebCamMorph>>toggleCameraOnOff (in category 'menu') -----
+ toggleCameraOnOff
+ 	camIsOn
+ 			ifTrue:[self off]
+ 			ifFalse:[self on]!

Item was added:
+ ----- Method: WebCamMorph>>toggleShowFPS (in category 'menu') -----
+ toggleShowFPS
+ 
+ 	showFPS := showFPS not.
+ !

Item was added:
+ ----- Method: WebCamMorph>>toggleUseFrameSize (in category 'menu') -----
+ toggleUseFrameSize
+ 
+ 	useFrameSize := useFrameSize not.
+ !

Item was added:
+ ----- Method: WebCamMorph>>updateDisplay (in category 'stepping and presenter') -----
+ updateDisplay
+ 	camIsOn ifTrue:[self nextFrame].
+ 	self updateFPS.
+ 	self changed.!

Item was added:
+ ----- Method: WebCamMorph>>updateFPS (in category 'stepping and presenter') -----
+ updateFPS
+ 
+ 	| now mSecs |
+ 	now := Time millisecondClockValue.
+ 	mSecs := now - lastDisplayTime.
+ 	(mSecs > 500 or: [mSecs < 0 "clock wrap-around"])
+ 		ifTrue: [
+ 			fps := (framesSinceLastDisplay * 1000) // mSecs.
+ 			lastDisplayTime := now.
+ 			framesSinceLastDisplay := 0].!

Item was added:
+ SymbolListType subclass: #WebCamOrientation
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'MorphicExtras-WebCam'!

Item was added:
+ ----- Method: WebCamOrientation class>>initialize (in category 'class initialization') -----
+ initialize
+ 
+ 	self addStandardVocabulary: self new.!

Item was added:
+ ----- Method: WebCamOrientation class>>orientations (in category 'constants') -----
+ orientations
+ 	^ #( native natural )!

Item was added:
+ ----- Method: WebCamOrientation class>>unload (in category 'class initialization') -----
+ unload
+ 
+ 	self allStandardVocabularies removeKey: self class name ifAbsent: [].!

Item was added:
+ ----- Method: WebCamOrientation class>>vocabularyName (in category 'constants') -----
+ vocabularyName
+ 
+ 	^ self name!

Item was added:
+ ----- Method: WebCamOrientation>>initialize (in category 'initialization') -----
+ initialize
+ 	super initialize.
+ 	self vocabularyName: self class vocabularyName.
+ 	
+ 	self symbols: self class orientations.!

Item was added:
+ ----- Method: WebCamOrientation>>representsAType (in category 'tiles') -----
+ representsAType
+ 	^true!

Item was added:
+ SymbolListType subclass: #WebCamResolution
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'MorphicExtras-WebCam'!

Item was added:
+ ----- Method: WebCamResolution class>>initialize (in category 'class initialization') -----
+ initialize
+ 
+ 	self addStandardVocabulary: self new.!

Item was added:
+ ----- Method: WebCamResolution class>>resolutions (in category 'constants') -----
+ resolutions
+ 	^ #(#'low' #'medium' #'high' #'hd')
+ !

Item was added:
+ ----- Method: WebCamResolution class>>vocabularyName (in category 'constants') -----
+ vocabularyName
+ 
+ 	^ self name!

Item was added:
+ ----- Method: WebCamResolution>>initialize (in category 'initialization') -----
+ initialize
+ 	super initialize.
+ 	self vocabularyName: self class vocabularyName.
+ 	
+ 	self symbols: self class resolutions
+ !

Item was added:
+ ----- Method: WebCamResolution>>representsAType (in category 'tiles') -----
+ representsAType
+ 	^true!



More information about the Squeak-dev mailing list