Sunday, May 2, 2021

Edward Lance Lorilla

Edward Lance Lorilla


【VISUAL VB.NET】Regional and Language Options

Posted: 02 May 2021 04:32 AM PDT

 Public Class Form1

Dim cmdProcess As Process = New Process() Dim fileArgs As String Dim path As String = "C:\Windows\System32\" Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click fileArgs = "Shell32.dll,Control_RunDLL Intl.cpl,,0" cmdProcess.StartInfo.Arguments = fileArgs cmdProcess.StartInfo.WorkingDirectory = path cmdProcess.StartInfo.FileName = "RunDll32.exe" cmdProcess.Start() cmdProcess.WaitForExit() Me.Show() End SubEnd Class

【JAVASCRIPT】Simple Check out Payment Request API

Posted: 01 May 2021 09:02 AM PDT

【PYTHON OPENCV】Face detection using OpenCV DNN face detector when feeding several images to the network and crop=True in function cv2.dnn.blobFromImages()

Posted: 01 May 2021 08:57 AM PDT

 """

Face detection using OpenCV DNN face detector when feeding several images to the network and crop=True in function cv2.dnn.blobFromImages() """ # Import required packages:import cv2import numpy as npfrom matplotlib import pyplot as plt def show_img_with_matplotlib(color_img, title, pos): """Shows an image using matplotlib capabilities""" img_RGB = color_img[:, :, ::-1] ax = plt.subplot(2, 2, pos) plt.imshow(img_RGB) plt.title(title) plt.axis('off') def get_cropped_imgs(imgs): """Returns the cropped images""" imgs_cropped = [] for img in imgs: # Create a copy of the image: img_copy = img.copy() # calculate size of resulting image: size = min(img_copy.shape[1], img_copy.shape[0]) # calculate x1, and y1 x1 = int(0.5 * (img_copy.shape[1] - size)) y1 = int(0.5 * (img_copy.shape[0] - size)) # crop and return the image imgs_cropped.append(img_copy[y1:(y1 + size), x1:(x1 + size)]) return imgs_cropped # Load pre-trained model:net = cv2.dnn.readNetFromCaffe("deploy.prototxt", "res10_300x300_ssd_iter_140000_fp16.caffemodel") # Load images and get the list of images:image = cv2.imread("face_test.png")image2 = cv2.imread("face_test2.jpg")images = [image, image2] # Get the cropped (original) images:images_cropped = get_cropped_imgs(images) # Call cv2.dnn.blobFromImages():blob_cropped = cv2.dnn.blobFromImages(images, 1.0, (300, 300), [104., 117., 123.], False, True) # Set the blob as input and obtain the detections:net.setInput(blob_cropped)detections = net.forward() # Iterate over all detections:# We have to check the first element of each detection to know which image it belongs to:for i in range(0, detections.shape[2]): # First, we have to get the image the detection belongs to: img_id = int(detections[0, 0, i, 0]) # Get the confidence of this prediction: confidence = detections[0, 0, i, 2] # Filter out weak predictions: if confidence > 0.25: # Get the size of the current image: (h, w) = images_cropped[img_id].shape[:2] # Get the (x,y) coordinates of the detection: box = detections[0, 0, i, 3:7] * np.array([w, h, w, h]) (startX, startY, endX, endY) = box.astype("int") # Draw bounding box and probability: text = "{:.2f}%".format(confidence * 100) y = startY - 10 if startY - 10 > 10 else startY + 10 # Note here that we are showing the results in the cropped images!: cv2.rectangle(images_cropped[img_id], (startX, startY), (endX, endY), (0, 0, 255), 2) cv2.putText(images_cropped[img_id], text, (startX, y), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (0, 0, 255), 2) # Create the dimensions of the figure and set title:fig = plt.figure(figsize=(16, 8))plt.suptitle("OpenCV DNN face detector when feeding several images and cropping", fontsize=14, fontweight='bold')fig.patch.set_facecolor('silver') # Show the input and the output images with the detections:show_img_with_matplotlib(image, "input img 1", 1)show_img_with_matplotlib(image2, "input img 2", 2)show_img_with_matplotlib(images_cropped[0], "output cropped img 1", 3)show_img_with_matplotlib(images_cropped[1], "output cropped img 2", 4) # Show the Figure:plt.show()

【GAMEMAKER】Treasure Hunting

Posted: 01 May 2021 08:51 AM PDT

 Information about object: obj_player

Sprite: spr_idle_down
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

///set up
enum player_state {
idle,
up,
down,
left,
right
}

dir=player_state.down;
is_moving=false;
image_speed=0.5;
Step Event:
execute code:

///keypress code
if (keyboard_check(vk_left))
{
dir=player_state.left;
is_moving=true;
}
else
if (keyboard_check(vk_right))
{
dir=player_state.right;
is_moving=true;
}
else
if (keyboard_check(vk_up))
{
dir=player_state.up;
is_moving=true;
}
else
if (keyboard_check(vk_down))
{
dir=player_state.down;
is_moving=true;
}
else
{
is_moving=false;
}
execute code:

///movement
if is_moving
{
switch (dir)
{
case player_state.up:
y -= 4;
break;

case player_state.down:
y += 4;
break;

case player_state.left:
x -= 4;
break;

case player_state.right:
x += 4;
break;
}
}
execute code:



///animation
if is_moving
{
switch (dir)
{
case player_state.up:
sprite_index=spr_walk_up;
break;

case player_state.down:
sprite_index=spr_walk_down;
break;

case player_state.left:
sprite_index=spr_walk_left;
break;

case player_state.right:
sprite_index=spr_walk_right;
break;
}
}
else
{
switch (dir)
{
case player_state.up:
sprite_index=spr_idle_up;
break;

case player_state.down:
sprite_index=spr_idle_down;
break;

case player_state.left:
sprite_index=spr_idle_left;
break;

case player_state.right:
sprite_index=spr_idle_right;
break;
}
}
execute code:

///dig for treasure

if keyboard_check_pressed(ord('Z')) && global.picks>0
{
global.picks--;
instance_create(x,y,obj_x);
instance_create(x,y,obj_has_dug);
}


Information about object: obj_treasure_here
Sprite: spr_treasure_here
Solid: false
Visible: false
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Information about object: obj_treasure
Sprite: spr_treasure
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Information about object: obj_hud
Sprite:
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create Event:
execute code:

global.gold=0;
global.picks=50;
Draw GUI Event:
execute code:

draw_set_colour(c_black);
draw_set_halign(fa_left);
draw_sprite(spr_pick,0,100,100);
draw_text(100,160,"Z to Dig - Picks Left "+string(global.picks));


Information about object: obj_x
Sprite: spr_no_treasure
Solid: false
Visible: true
Depth:
-50
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create Event:
execute code:

other_id=noone;
distance=0;
can_show=true;
if instance_exists(obj_treasure_here)
{
other_id=instance_nearest(x,y,obj_treasure_here);
}
alarm[0]=room_speed*3;
Alarm Event for alarm 0:
execute code:

instance_destroy();
Step Event:
execute code:

if instance_exists(other_id)
{
distance=round(distance_to_point(other_id.x,other_id.y));
}
else
{
distance=0;
}
Draw Event:
execute code:

draw_self();
if distance!=0 && can_show
{

draw_set_colour(c_yellow);
draw_set_halign(fa_center);
draw_text(x,y-32,"Nearest Buried Treasure: "+string(distance)+"-Meters");
}

Information about object: obj_has_dug
Sprite: spr_has_dug
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Collision Event with object obj_treasure_here:
execute code:

instance_create(other.x,other.y,obj_treasure);
with (other) instance_destroy();

No comments:

Post a Comment