Skip to main content

Posts

Showing posts with the label python

URSINA - Gaming engine - opensource-python

 HERE COMES THE EASY PYTHON GAMING ENGINE DESIGN AND DEVELOP GAMES AND PLAY AND EVEN TRAIN UR GAMES FOR NEURAL NETWORKS go and download and install pretty easy - https://www.ursinaengine.org/installation.html once the installation is done run this sample from the site which is simple cube movement using keys similar to what we have played during our earlier gaming days https://www.ursinaengine.org/introduction_tutorial.html      sample  code for simple 3D game design- from ursina import * from ursina.prefabs.first_person_controller import FirstPersonController   app = Ursina()   cube_orange = Entity(model='cube', color=color.orange, scale_y=20,texture='white_cube') cube_orange_right = duplicate(cube_orange, origin_z=20) blue_cube = Entity(model='cube', color=color.blue, scale_y=2, origin_x=5,texture='vignette') duplicate(cube_orange,origin_x=10) duplicate(cube_orange,origin_x=20) duplicate(cube_orange,origin_x=30) duplicate(cube_orange,origin_x=40) dupl

Tutorial - numpy for changing color of an image at pixel level.

import numpy as np import matplotlib.pyplot as plt import cv2 as cv #this program conversts color of certain sections of image #each pixel is checked for the r g b and modified using a numpy array image = cv.imread('rg.png') #print(image.shape) #print(np.asarray(image)) width , height , channels = image.shape #print(width) #print(height) #print(channels) plt.imshow(image) plt.show() #print(image[29][29]) zero_array = np.zeros((2, 3, 3)) for pixeli in range(width):     #print(pixeli)     for pixelj in range(height):        # print(pixeli,pixelj)         #print(image[pixeli][pixelj])         pixelvalue = image[pixeli][pixelj]         #print(pixelvalue)         if pixelvalue[0] == 76 and pixelvalue[1] == 177 and pixelvalue[2] == 34:             #print('mach')             r = 0             g = 0             b = 0             image[pixeli][pixelj] = [r, g, b]   plt.imshow(image) plt.show() The pixel level color are changed as y